dt-common-device 13.2.1 → 13.3.0
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.
|
@@ -99,6 +99,7 @@ let AdminService = (() => {
|
|
|
99
99
|
return await this.adminRepository.getZonesByAccessGroups(accessGroupIds, type);
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
|
+
console.log(error);
|
|
102
103
|
return [];
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -295,7 +296,6 @@ let AdminService = (() => {
|
|
|
295
296
|
return await this.adminRepository.getAccessGroups(propertyId, accessibleBy);
|
|
296
297
|
}
|
|
297
298
|
async getChildCollectionsByParentIds(parentIds) {
|
|
298
|
-
console.log("parentIds for collection heirarchy:----->", parentIds);
|
|
299
299
|
return await this.adminRepository.getChildCollectionsByParentIds(parentIds);
|
|
300
300
|
}
|
|
301
301
|
async deleteAllCollectionHierarchy(propertyId, source) {
|
|
@@ -6,6 +6,7 @@ export interface IAccessGroup {
|
|
|
6
6
|
type: string;
|
|
7
7
|
externalId?: string;
|
|
8
8
|
refId?: string;
|
|
9
|
+
isActive: boolean;
|
|
9
10
|
isDeleted: boolean;
|
|
10
11
|
createdBy: string;
|
|
11
12
|
createdAt: Date;
|
|
@@ -20,6 +21,7 @@ export interface IZoneAccessGroup {
|
|
|
20
21
|
export interface IZone {
|
|
21
22
|
id: string;
|
|
22
23
|
name: string;
|
|
24
|
+
isActive: boolean;
|
|
23
25
|
propertyId: string;
|
|
24
26
|
parentId?: string;
|
|
25
27
|
zoneTypeId: string;
|
|
@@ -145,33 +145,20 @@ let PmsService = (() => {
|
|
|
145
145
|
throw new Error("Access Group ID is required");
|
|
146
146
|
}
|
|
147
147
|
const scheduleAccessGroups = await this.pmsRepository.getScheduleAccessGroups(scheduleId);
|
|
148
|
-
console.log("Schedule Access Groups for consecutive room occupancy check:", scheduleAccessGroups);
|
|
149
148
|
if (!scheduleAccessGroups || scheduleAccessGroups.length === 0) {
|
|
150
149
|
return false;
|
|
151
150
|
}
|
|
152
151
|
const orderedAccessGroups = [...scheduleAccessGroups].sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for (let i = 0; i < orderedAccessGroups.length; i++) {
|
|
156
|
-
if (orderedAccessGroups[i].accessGroupId === accessGroupId) {
|
|
157
|
-
matchingIndices.push(i);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (matchingIndices.length === 0) {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
const firstIndex = matchingIndices[0];
|
|
164
|
-
const lastIndex = matchingIndices[matchingIndices.length - 1];
|
|
165
|
-
// Ensure all occurrences are contiguous (no other room between them)
|
|
166
|
-
if (lastIndex - firstIndex + 1 !== matchingIndices.length) {
|
|
152
|
+
// First entry new code should be assigned
|
|
153
|
+
if (orderedAccessGroups.length < 2) {
|
|
167
154
|
return false;
|
|
168
155
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
156
|
+
const last = orderedAccessGroups?.at(-1);
|
|
157
|
+
const secondLast = orderedAccessGroups?.at(-2);
|
|
158
|
+
// True only if last and second last entries are same and equal to accessGroupId
|
|
159
|
+
return (last.accessGroupId === accessGroupId &&
|
|
160
|
+
secondLast.accessGroupId === accessGroupId //B A(secondLast) A(last)
|
|
161
|
+
);
|
|
175
162
|
}
|
|
176
163
|
};
|
|
177
164
|
__setFunctionName(_classThis, "PmsService");
|
|
@@ -141,7 +141,25 @@ let IssueRepository = (() => {
|
|
|
141
141
|
const query = this.buildQuery(filters);
|
|
142
142
|
const options = this.buildOptions(filters);
|
|
143
143
|
const results = await Issue_model_1.IssueModel.find(query, null, options);
|
|
144
|
-
|
|
144
|
+
let issues = results?.map((result) => result.toObject()) || [];
|
|
145
|
+
const offlineFilter = filters.filterOfflineLessThan24Hours;
|
|
146
|
+
if (offlineFilter) {
|
|
147
|
+
const cutoff = offlineFilter.createdAt
|
|
148
|
+
? new Date(offlineFilter.createdAt)
|
|
149
|
+
: new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
150
|
+
if (!Number.isNaN(cutoff.getTime())) {
|
|
151
|
+
issues = issues.filter((issue) => {
|
|
152
|
+
const issueCreatedAt = new Date(issue.createdAt);
|
|
153
|
+
if (Number.isNaN(issueCreatedAt.getTime()))
|
|
154
|
+
return true;
|
|
155
|
+
const matchesType = issue.type === offlineFilter.type;
|
|
156
|
+
const matchesSubType = issue.entitySubType === offlineFilter.subType;
|
|
157
|
+
const isOlderThanCutoff = issueCreatedAt < cutoff;
|
|
158
|
+
return !(matchesType && matchesSubType && isOlderThanCutoff);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return issues;
|
|
145
163
|
}
|
|
146
164
|
catch (error) {
|
|
147
165
|
throw new Error(`Failed to find issues: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -193,7 +211,24 @@ let IssueRepository = (() => {
|
|
|
193
211
|
async count(filters = {}) {
|
|
194
212
|
try {
|
|
195
213
|
const query = this.buildQuery(filters);
|
|
196
|
-
|
|
214
|
+
let total = await Issue_model_1.IssueModel.countDocuments(query);
|
|
215
|
+
const offlineFilter = filters.filterOfflineLessThan24Hours;
|
|
216
|
+
if (offlineFilter) {
|
|
217
|
+
const cutoff = offlineFilter.createdAt
|
|
218
|
+
? new Date(offlineFilter.createdAt)
|
|
219
|
+
: new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
220
|
+
if (!Number.isNaN(cutoff.getTime())) {
|
|
221
|
+
const excludeQuery = {
|
|
222
|
+
...query,
|
|
223
|
+
type: offlineFilter.type,
|
|
224
|
+
entitySubType: offlineFilter.subType,
|
|
225
|
+
createdAt: { $lt: cutoff },
|
|
226
|
+
};
|
|
227
|
+
const excludeCount = await Issue_model_1.IssueModel.countDocuments(excludeQuery);
|
|
228
|
+
total = Math.max(0, total - excludeCount);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return total;
|
|
197
232
|
}
|
|
198
233
|
catch (error) {
|
|
199
234
|
throw new Error(`Failed to count issues: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -180,6 +180,11 @@ export interface IIssueQuery {
|
|
|
180
180
|
includeDeleted?: boolean;
|
|
181
181
|
startDate?: string;
|
|
182
182
|
endDate?: string;
|
|
183
|
+
filterOfflineLessThan24Hours?: {
|
|
184
|
+
type: IssueType;
|
|
185
|
+
subType: EntitySubType;
|
|
186
|
+
createdAt?: string | Date;
|
|
187
|
+
};
|
|
183
188
|
limit?: number;
|
|
184
189
|
skip?: number;
|
|
185
190
|
sort?: {
|