dt-common-device 7.6.0 → 7.6.2
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.
- package/dist/alerts/Alert.service.d.ts +2 -3
- package/dist/alerts/Alert.service.js +4 -4
- package/dist/entities/admin/Admin.repository.js +7 -1
- package/dist/entities/pms/pms.repository.d.ts +1 -0
- package/dist/entities/pms/pms.repository.js +11 -0
- package/dist/entities/pms/pms.service.d.ts +1 -0
- package/dist/entities/pms/pms.service.js +9 -0
- package/package.json +1 -1
|
@@ -3,7 +3,6 @@ import { CreateAlertData, UpdateAlertData, AlertCategory, AlertSeverity, IAlertQ
|
|
|
3
3
|
import { AlertBuilder } from "./AlertBuilder";
|
|
4
4
|
import { IDevice } from "../entities/device/local/interfaces";
|
|
5
5
|
import { Source } from "../constants";
|
|
6
|
-
import { IUser } from "../entities/admin";
|
|
7
6
|
export declare class AlertService {
|
|
8
7
|
private readonly alertRepository;
|
|
9
8
|
constructor();
|
|
@@ -37,8 +36,8 @@ export declare class AlertService {
|
|
|
37
36
|
raiseDeviceOnlineAlert(device: IDevice, source: Source): Promise<IAlertDocument | null>;
|
|
38
37
|
raiseLockAccessEmergencyCodeAlert(device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
|
|
39
38
|
raiseLockAccessMasterCodeAlert(device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
|
|
40
|
-
raiseSpecificDoorAccessAlert(
|
|
41
|
-
raiseGuestLockFirstAccessAlert(
|
|
39
|
+
raiseSpecificDoorAccessAlert(userName: string, device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
|
|
40
|
+
raiseGuestLockFirstAccessAlert(userName: string, device: IDevice, zone: any, source: Source): Promise<IAlertDocument | null>;
|
|
42
41
|
/**
|
|
43
42
|
* Create a new alert with business logic validation
|
|
44
43
|
* Accepts either a CreateAlertData object or an AlertBuilder instance
|
|
@@ -268,7 +268,7 @@ let AlertService = (() => {
|
|
|
268
268
|
type: alert_types_1.AlertType.LOCK_ACCESS_MASTER_CODE,
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
-
async raiseSpecificDoorAccessAlert(
|
|
271
|
+
async raiseSpecificDoorAccessAlert(userName, device, zone, source) {
|
|
272
272
|
return await this.createAlert({
|
|
273
273
|
entityId: device.deviceId,
|
|
274
274
|
entityType: alert_types_1.EntityType.DEVICE,
|
|
@@ -276,14 +276,14 @@ let AlertService = (() => {
|
|
|
276
276
|
propertyId: device.propertyId,
|
|
277
277
|
zoneId: device.zoneId,
|
|
278
278
|
title: "Specific Door Access",
|
|
279
|
-
description: `${
|
|
279
|
+
description: `${userName} has accessed ${zone?.name}.`,
|
|
280
280
|
createdBy: source,
|
|
281
281
|
category: alert_types_1.AlertCategory.OTHER,
|
|
282
282
|
severity: alert_types_1.AlertSeverity.INFO,
|
|
283
283
|
type: alert_types_1.AlertType.SPECIFIC_DOOR_ACCESS,
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
-
async raiseGuestLockFirstAccessAlert(
|
|
286
|
+
async raiseGuestLockFirstAccessAlert(userName, device, zone, source) {
|
|
287
287
|
return await this.createAlert({
|
|
288
288
|
entityId: device.deviceId,
|
|
289
289
|
entityType: alert_types_1.EntityType.DEVICE,
|
|
@@ -291,7 +291,7 @@ let AlertService = (() => {
|
|
|
291
291
|
propertyId: device.propertyId,
|
|
292
292
|
zoneId: device.zoneId,
|
|
293
293
|
title: "Guest Used Code for First Time",
|
|
294
|
-
description: `${
|
|
294
|
+
description: `${userName} has used the code for the first time to access ${zone?.name}.`,
|
|
295
295
|
createdBy: source,
|
|
296
296
|
category: alert_types_1.AlertCategory.OTHER,
|
|
297
297
|
severity: alert_types_1.AlertSeverity.INFO,
|
|
@@ -223,7 +223,13 @@ let AdminRepository = (() => {
|
|
|
223
223
|
try {
|
|
224
224
|
const zone = await this.postgres.query(`SELECT * FROM dt_zones WHERE "id" = $1`, [zoneId]);
|
|
225
225
|
if (zone.rows.length > 0) {
|
|
226
|
-
|
|
226
|
+
const zoneData = zone.rows[0];
|
|
227
|
+
const zoneType = await this.postgres.query(`SELECT * FROM dt_zoneTypes WHERE "id" = $1`, [zoneData.zoneTypeId]);
|
|
228
|
+
zoneData.zoneType = {
|
|
229
|
+
id: zoneType.rows[0].id,
|
|
230
|
+
name: zoneType.rows[0].name,
|
|
231
|
+
};
|
|
232
|
+
return zoneData;
|
|
227
233
|
}
|
|
228
234
|
return null;
|
|
229
235
|
}
|
|
@@ -6,4 +6,5 @@ export declare class PmsRepository {
|
|
|
6
6
|
getScheduleIdByAccessGroupId(accessGroupId: string, status: string): Promise<string | null>;
|
|
7
7
|
getGuest(guestId: string): Promise<IGuest | null>;
|
|
8
8
|
getGuestId(scheduleId: string): Promise<string | null>;
|
|
9
|
+
getScheduleByGuestId(guestId: string): Promise<IPmsSchedule | null>;
|
|
9
10
|
}
|
|
@@ -92,6 +92,17 @@ let PmsRepository = (() => {
|
|
|
92
92
|
}
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
+
async getScheduleByGuestId(guestId) {
|
|
96
|
+
const scheduleMap = await this.pmsPostgres.query(`SELECT * FROM dt_schedule_guest_map WHERE "guestId" = $1`, [guestId]);
|
|
97
|
+
if (scheduleMap.rows.length > 0) {
|
|
98
|
+
const scheduleId = scheduleMap.rows[0].scheduleId;
|
|
99
|
+
const schedule = await this.getSchedule(scheduleId);
|
|
100
|
+
if (schedule) {
|
|
101
|
+
return schedule;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
95
106
|
};
|
|
96
107
|
__setFunctionName(_classThis, "PmsRepository");
|
|
97
108
|
(() => {
|
|
@@ -6,4 +6,5 @@ export declare class PmsService {
|
|
|
6
6
|
getScheduleIdByAccessGroupId(accessGroupId: string, status: string): Promise<string | null>;
|
|
7
7
|
getGuest(guestId: string): Promise<IGuest | null>;
|
|
8
8
|
getGuestId(scheduleId: string): Promise<string | null>;
|
|
9
|
+
getScheduleByGuestId(guestId: string): Promise<IPmsSchedule | null>;
|
|
9
10
|
}
|
|
@@ -119,6 +119,15 @@ let PmsService = (() => {
|
|
|
119
119
|
return null;
|
|
120
120
|
return guestId;
|
|
121
121
|
}
|
|
122
|
+
async getScheduleByGuestId(guestId) {
|
|
123
|
+
if (!guestId) {
|
|
124
|
+
throw new Error("Guest ID is required");
|
|
125
|
+
}
|
|
126
|
+
const schedule = await this.pmsRepository.getScheduleByGuestId(guestId);
|
|
127
|
+
if (!schedule)
|
|
128
|
+
return null;
|
|
129
|
+
return schedule;
|
|
130
|
+
}
|
|
122
131
|
};
|
|
123
132
|
__setFunctionName(_classThis, "PmsService");
|
|
124
133
|
(() => {
|