dt-common-device 13.4.13 → 13.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -90,13 +90,10 @@ let EmailService = (() => {
|
|
|
90
90
|
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? "",
|
|
91
91
|
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? "",
|
|
92
92
|
};
|
|
93
|
-
console.log("credentials:------", credentials);
|
|
94
93
|
const region = process.env.AWS_REGION ?? "us-east-1";
|
|
95
94
|
this.s3Client = new client_s3_1.S3Client({ credentials, region });
|
|
96
95
|
this.sesClient = new client_ses_1.SESClient({ credentials, region });
|
|
97
96
|
this.propertyService = typedi_1.default.get(Property_service_1.LocalPropertyService);
|
|
98
|
-
console.log("s3Client:------", this.s3Client);
|
|
99
|
-
console.log("sesClient:------", this.sesClient);
|
|
100
97
|
}
|
|
101
98
|
async getTemplateForProperty(fileName, propertyId) {
|
|
102
99
|
let res;
|
|
@@ -275,7 +272,6 @@ let EmailService = (() => {
|
|
|
275
272
|
(0, config_1.getLogger)().info(`Sending email to: ${maskedEmailsList.join(", ")}`);
|
|
276
273
|
}
|
|
277
274
|
catch (error) {
|
|
278
|
-
console.log("error in sendMail:------", error);
|
|
279
275
|
(0, config_1.getLogger)().error("sendMail: Error", JSON.stringify(error));
|
|
280
276
|
}
|
|
281
277
|
}
|
|
@@ -83,7 +83,15 @@ let ConnectionRepository = (() => {
|
|
|
83
83
|
// Build conditions dynamically based on provided query parameters
|
|
84
84
|
Object.keys(query).forEach((key) => {
|
|
85
85
|
const value = query[key];
|
|
86
|
-
if (value
|
|
86
|
+
if (value === undefined || value === null)
|
|
87
|
+
return;
|
|
88
|
+
// ✅ Special handling for metaData (JSON)
|
|
89
|
+
if (key === "metaData" && typeof value === "object") {
|
|
90
|
+
conditions.push(`"metaData" @> $${paramIndex}`);
|
|
91
|
+
values.push(JSON.stringify(value));
|
|
92
|
+
paramIndex++;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
87
95
|
conditions.push(`"${key}" = $${paramIndex}`);
|
|
88
96
|
values.push(value);
|
|
89
97
|
paramIndex++;
|
|
@@ -148,19 +148,30 @@ let PmsService = (() => {
|
|
|
148
148
|
if (!scheduleAccessGroups || scheduleAccessGroups.length === 0) {
|
|
149
149
|
return false;
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
|
|
151
|
+
// Split reservations often have multiple rows per schedule with the *same* startTime
|
|
152
|
+
// across different access groups. Sorting *all* rows globally made the last two entries
|
|
153
|
+
// always different access groups. Here we only consider rows for this accessGroupId,
|
|
154
|
+
// ordered by startTime, and require the latest segment to follow the previous one in time.
|
|
155
|
+
const rowsForThisAccessGroup = scheduleAccessGroups
|
|
156
|
+
.filter((row) => row.accessGroupId === accessGroupId)
|
|
157
|
+
.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
|
|
158
|
+
if (rowsForThisAccessGroup.length < 2) {
|
|
154
159
|
return false;
|
|
155
160
|
}
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
);
|
|
161
|
+
const previousSegment = rowsForThisAccessGroup.at(-2);
|
|
162
|
+
const currentSegment = rowsForThisAccessGroup.at(-1);
|
|
163
|
+
if (!previousSegment.endTime || !currentSegment.startTime) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const previousStart = new Date(previousSegment.startTime).getTime();
|
|
167
|
+
const previousEnd = new Date(previousSegment.endTime).getTime();
|
|
168
|
+
const currentStart = new Date(currentSegment.startTime).getTime();
|
|
169
|
+
// Same startTime as previous row (duplicate import, extra map row, etc.) — still reuse one code.
|
|
170
|
+
if (currentStart === previousStart) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
// Consecutive nights: current segment starts at or after previous segment ends.
|
|
174
|
+
return currentStart >= previousEnd;
|
|
164
175
|
}
|
|
165
176
|
};
|
|
166
177
|
__setFunctionName(_classThis, "PmsService");
|