@7365admin1/module-hygiene 4.13.0 → 4.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Hygiene Cleaning Schedule Enhancement Release
8
+
3
9
  ## 4.13.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -83,7 +83,7 @@ declare function useAreaRepo(): {
83
83
  createUniqueIndex: () => Promise<void>;
84
84
  createArea: (value: TAreaCreate, session?: ClientSession) => Promise<ObjectId>;
85
85
  getAreas: ({ page, limit, search, type, site, serviceType, }: TAreaGetQuery) => Promise<{}>;
86
- getAreasForChecklist: (site: string | ObjectId, serviceType?: TServiceType) => Promise<{}>;
86
+ getAreasForChecklist: (site: string | ObjectId, serviceType: TServiceType) => Promise<{}>;
87
87
  getAreaById: (_id: string | ObjectId) => Promise<{}>;
88
88
  verifyAreaByUnitId: (unitId: string | ObjectId) => Promise<{}>;
89
89
  updateArea: (_id: string | ObjectId, value: TAreaUpdate, session?: ClientSession) => Promise<number>;
@@ -220,12 +220,20 @@ declare function useParentChecklistRepo(): {
220
220
  createIndex: () => Promise<void>;
221
221
  createParentChecklist: (value: TParentChecklist, session?: ClientSession) => Promise<ObjectId | ObjectId[]>;
222
222
  getAllParentChecklist: ({ page, limit, search, site, startDate, endDate, status, serviceType, }: TParentChecklistGetQuery) => Promise<{}>;
223
+ getParentChecklistById: (_id: string | ObjectId) => Promise<TParentChecklist & {
224
+ _id: ObjectId;
225
+ }>;
223
226
  updateParentChecklistStatuses: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
224
227
  closeExpiredParentChecklists: () => Promise<number>;
225
228
  getTodayParentChecklists: () => Promise<{
226
229
  _id: ObjectId;
227
230
  site: ObjectId;
228
231
  }[]>;
232
+ getTodayParentChecklistsForAreaGen: () => Promise<{
233
+ _id: ObjectId;
234
+ site: ObjectId;
235
+ serviceType: string;
236
+ }[]>;
229
237
  };
230
238
 
231
239
  declare function useParentChecklistController(): {
@@ -237,6 +245,7 @@ declare const allowedChecklistStatus: string[];
237
245
  type TCleaningScheduleArea = {
238
246
  _id?: ObjectId;
239
247
  schedule: string | ObjectId;
248
+ serviceType: TServiceType;
240
249
  area: string | ObjectId;
241
250
  name: string;
242
251
  type: (typeof allowedTypes)[number];
@@ -265,8 +274,8 @@ type TAreaChecklistUnits = {
265
274
  completedBy?: string | ObjectId;
266
275
  timestamp?: Date | string;
267
276
  };
268
- type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "area"> & {
269
- site: string | ObjectId;
277
+ type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "area" | "name" | "type" | "checklist" | "createdBy"> & {
278
+ serviceType: TServiceType;
270
279
  };
271
280
  type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule" | "createdBy"> & {
272
281
  site: string | ObjectId;
@@ -275,14 +284,16 @@ type TCleaningScheduleAreaGetQuery = {
275
284
  page?: number;
276
285
  limit?: number;
277
286
  search?: string;
287
+ serviceType?: TServiceType;
278
288
  type?: (typeof allowedTypes)[number] | "all";
279
289
  status?: (typeof allowedStatus)[number] | "all";
280
290
  } & Pick<TCleaningScheduleArea, "schedule">;
281
291
  type TAreaChecklistUpdate = Pick<TCleaningScheduleArea, "checklist">;
282
292
  type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "approve" | "reject" | "remarks" | "completedBy"> & Pick<TAreaChecklist, "attachment">;
283
293
  declare const areaChecklistSchema: Joi.ObjectSchema<any>;
284
- declare function MAreaChecklist(value: TCleaningScheduleArea): {
294
+ declare function MAreaChecklist(value: TAreaChecklistCreate): {
285
295
  schedule: string | ObjectId;
296
+ serviceType: ServiceType;
286
297
  area: string | ObjectId;
287
298
  name: string;
288
299
  type: string;
@@ -332,8 +343,8 @@ declare function useAreaChecklistRepo(): {
332
343
  createIndex: () => Promise<void>;
333
344
  createTextIndex: () => Promise<void>;
334
345
  createUniqueIndex: () => Promise<void>;
335
- createAreaChecklist: (value: TCleaningScheduleArea, session?: ClientSession) => Promise<ObjectId>;
336
- getAllAreaChecklist: ({ page, limit, search, type, status, schedule, }: TCleaningScheduleAreaGetQuery, session?: ClientSession) => Promise<{}>;
346
+ createAreaChecklist: (value: TAreaChecklistCreate, session?: ClientSession) => Promise<ObjectId>;
347
+ getAllAreaChecklist: ({ page, limit, search, type, status, schedule, serviceType, }: TCleaningScheduleAreaGetQuery, session?: ClientSession) => Promise<{}>;
337
348
  getAreaChecklistHistory: ({ page, limit, search, type, schedule, status, createdAt, }: {
338
349
  page?: number | undefined;
339
350
  limit?: number | undefined;
@@ -344,22 +355,28 @@ declare function useAreaChecklistRepo(): {
344
355
  createdAt?: string | Date | undefined;
345
356
  }) => Promise<{}>;
346
357
  getAreaChecklistHistoryDetails: (_id: string | ObjectId) => Promise<{}>;
347
- getAreaChecklistUnits: ({ page, limit, search, _id, }: {
358
+ getAreaChecklistUnits: ({ page, limit, search, serviceType, _id, }: {
348
359
  page?: number | undefined;
349
360
  limit?: number | undefined;
350
361
  search?: string | undefined;
362
+ serviceType?: ServiceType | undefined;
351
363
  _id: string | ObjectId;
352
364
  }, session?: ClientSession) => Promise<{}>;
353
365
  getAreaChecklistById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
354
- getAreaChecklistByAreaAndSchedule: (schedule: string | ObjectId, area: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
366
+ getAreaChecklistByAreaAndSchedule: ({ schedule, serviceType, area, session, }: {
367
+ schedule: string | ObjectId;
368
+ serviceType?: ServiceType | undefined;
369
+ area: string | ObjectId;
370
+ session?: ClientSession | undefined;
371
+ }) => Promise<mongodb.WithId<bson.Document>>;
355
372
  getAreaChecklistSetOwner: (_id: string | ObjectId, set: number, session?: ClientSession) => Promise<any>;
356
373
  updateAreaChecklist: (_id: string | ObjectId, value: TAreaChecklistUpdate, session?: ClientSession) => Promise<number>;
357
374
  updateAreaChecklistStatus: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
358
375
  updateAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate, session?: ClientSession) => Promise<number>;
359
376
  getMaxSetNumberForArea: (areaId: string | ObjectId, session?: ClientSession) => Promise<any>;
360
377
  closeExpiredAreaChecklists: () => Promise<number>;
361
- pushScheduleTaskSets: (scheduleId: string | ObjectId, areaId: string | ObjectId, scheduleTaskId: string | ObjectId, newSets: TAreaChecklist[]) => Promise<number>;
362
- insertAutoGenSets: (scheduleId: string | ObjectId, areaId: string | ObjectId, newSets: any[]) => Promise<number>;
378
+ pushScheduleTaskSets: (scheduleId: string | ObjectId, serviceType: TServiceType, areaId: string | ObjectId, scheduleTaskId: string | ObjectId, newSets: TAreaChecklist[]) => Promise<number>;
379
+ insertAutoGenSets: (scheduleId: string | ObjectId, serviceType: TServiceType, areaId: string | ObjectId, newSets: any[]) => Promise<number>;
363
380
  trimOverflowSets: () => Promise<number>;
364
381
  };
365
382
 
@@ -541,6 +558,7 @@ declare function useCheckOutItemController(): {
541
558
  type TScheduleTask = {
542
559
  _id?: ObjectId;
543
560
  site: string | ObjectId;
561
+ serviceType: TServiceType;
544
562
  title: string;
545
563
  time: string;
546
564
  dates: string[];
@@ -555,17 +573,18 @@ type TScheduleTask = {
555
573
  updatedAt?: string | Date;
556
574
  deletedAt?: string | Date;
557
575
  };
558
- type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "title" | "time" | "dates" | "description" | "areas" | "createdBy">;
576
+ type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas" | "createdBy">;
559
577
  type TScheduleTaskGetQuery = {
560
578
  page?: number;
561
579
  limit?: number;
562
580
  search?: string;
563
- } & Pick<TScheduleTask, "site">;
581
+ } & Pick<TScheduleTask, "site" | "serviceType">;
564
582
  type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "createdBy" | "createdAt">;
565
583
  type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas">>;
566
584
  declare const scheduleTaskSchema: Joi.ObjectSchema<any>;
567
585
  declare function MScheduleTask(value: TScheduleTaskCreate): {
568
586
  site: string | ObjectId;
587
+ serviceType: ServiceType;
569
588
  title: string;
570
589
  time: string;
571
590
  dates: string[];
@@ -585,15 +604,14 @@ declare function useScheduleTaskRepository(): {
585
604
  createIndex: () => Promise<void>;
586
605
  createTextIndex: () => Promise<void>;
587
606
  createScheduleTask: (value: TScheduleTaskCreate, session?: ClientSession) => Promise<ObjectId>;
588
- getScheduleTasks: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
607
+ getScheduleTasks: ({ page, limit, search, site, serviceType, }: TScheduleTaskGetQuery) => Promise<{}>;
589
608
  getAllScheduleTask: () => Promise<TScheduleTask[]>;
590
- getTasksForScheduleTask: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
591
609
  getScheduleTaskById: (_id: string | ObjectId, session?: ClientSession) => Promise<TScheduleTaskGetById>;
592
610
  updateScheduleTask: (_id: string | ObjectId, value: TScheduleTaskUpdate, session?: ClientSession) => Promise<number>;
593
611
  };
594
612
 
595
613
  declare function useScheduleTaskService(): {
596
- checkScheduleConditions: (schedule: any, currentDate?: Date) => boolean;
614
+ checkScheduleConditions: (schedule: any, serviceType: TServiceType, currentDate?: Date) => boolean;
597
615
  processScheduledTasks: (currentDate?: Date) => Promise<{
598
616
  processed: number;
599
617
  validated: number;
@@ -608,7 +626,6 @@ declare function useScheduleTaskService(): {
608
626
  declare function useScheduleTaskController(): {
609
627
  createScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
610
628
  getScheduleTasks: (req: Request, res: Response, next: NextFunction) => Promise<void>;
611
- getTasksForScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
612
629
  getScheduleTaskById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
613
630
  updateScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
614
631
  };