dt-common-device 7.6.0 → 7.6.1

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.
@@ -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
- return zone.rows[0];
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
  (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "7.6.0",
3
+ "version": "7.6.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [