@7365admin1/module-hygiene 4.13.0 → 4.15.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,17 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update module hygiene version
8
+
9
+ ## 4.14.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Hygiene Cleaning Schedule Enhancement Release
14
+
3
15
  ## 4.13.0
4
16
 
5
17
  ### 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
 
@@ -376,6 +393,7 @@ declare function useAreaChecklistController(): {
376
393
  type TSupply = {
377
394
  _id?: ObjectId;
378
395
  site: string | ObjectId;
396
+ serviceType: TServiceType;
379
397
  name: string;
380
398
  unitOfMeasurement: string;
381
399
  qty: number;
@@ -384,17 +402,18 @@ type TSupply = {
384
402
  updatedAt?: string;
385
403
  deletedAt?: string;
386
404
  };
387
- type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement">;
405
+ type TSupplyCreate = Pick<TSupply, "site" | "serviceType" | "name" | "unitOfMeasurement">;
388
406
  type TSupplyGetQuery = {
389
407
  page?: number;
390
408
  limit?: number;
391
409
  search?: string;
392
- } & Pick<TSupply, "site">;
410
+ } & Pick<TSupply, "site" | "serviceType">;
393
411
  type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty">;
394
412
  type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
395
413
  declare const supplySchema: Joi.ObjectSchema<any>;
396
414
  declare function MSupply(value: TSupplyCreate): {
397
415
  site: string | ObjectId;
416
+ serviceType: ServiceType;
398
417
  name: string;
399
418
  unitOfMeasurement: string;
400
419
  qty: number;
@@ -409,7 +428,7 @@ declare function useSupplyRepository(): {
409
428
  createTextIndex: () => Promise<void>;
410
429
  createUniqueIndex: () => Promise<void>;
411
430
  createSupply: (value: TSupplyCreate, session?: ClientSession) => Promise<ObjectId>;
412
- getSupplies: ({ page, limit, search, site, }: TSupplyGetQuery) => Promise<{}>;
431
+ getSupplies: ({ page, limit, search, site, serviceType, }: TSupplyGetQuery) => Promise<{}>;
413
432
  getSupplyById: (_id: string | ObjectId, session?: ClientSession) => Promise<TSupplyGetById>;
414
433
  updateSupply: (_id: string | ObjectId, value: TSupplyUpdate, session?: ClientSession) => Promise<number>;
415
434
  deleteSupply: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
@@ -426,6 +445,7 @@ declare function useSupplyController(): {
426
445
  type TStock = {
427
446
  _id?: ObjectId;
428
447
  site: string | ObjectId;
448
+ serviceType: TServiceType;
429
449
  supply: string | ObjectId;
430
450
  in?: number;
431
451
  out?: number;
@@ -436,18 +456,19 @@ type TStock = {
436
456
  updatedAt?: string;
437
457
  deletedAt?: string;
438
458
  };
439
- type TStockCreate = Pick<TStock, "site" | "supply" | "in" | "out" | "balance" | "remarks">;
440
- type TStockCreateService = Pick<TStock, "site" | "supply" | "remarks"> & {
459
+ type TStockCreate = Pick<TStock, "site" | "serviceType" | "supply" | "in" | "out" | "balance" | "remarks">;
460
+ type TStockCreateService = Pick<TStock, "site" | "serviceType" | "supply" | "remarks"> & {
441
461
  qty: number;
442
462
  };
443
463
  type TGetStocksQuery = {
444
464
  page?: number;
445
465
  limit?: number;
446
466
  search?: string;
447
- } & Pick<TStock, "site" | "supply">;
467
+ } & Pick<TStock, "site" | "serviceType" | "supply">;
448
468
  declare const stockSchema: Joi.ObjectSchema<any>;
449
469
  declare function MStock(value: TStockCreate): {
450
470
  site: string | ObjectId;
471
+ serviceType: ServiceType;
451
472
  supply: string | ObjectId;
452
473
  in: number;
453
474
  out: number;
@@ -462,7 +483,7 @@ declare function MStock(value: TStockCreate): {
462
483
  declare function useStockRepository(): {
463
484
  createIndex: () => Promise<void>;
464
485
  createStock: (value: TStockCreate, session?: ClientSession) => Promise<ObjectId>;
465
- getStocksBySupplyId: ({ page, limit, search, site, supply, }: TGetStocksQuery) => Promise<{}>;
486
+ getStocksBySupplyId: ({ page, limit, search, site, serviceType, supply, }: TGetStocksQuery) => Promise<{}>;
466
487
  };
467
488
 
468
489
  declare function useStockService(): {
@@ -478,6 +499,7 @@ declare const allowedCheckOutItemStatus: string[];
478
499
  type TCheckOutItem = {
479
500
  _id?: ObjectId;
480
501
  site: string | ObjectId;
502
+ serviceType: TServiceType;
481
503
  supply: string | ObjectId;
482
504
  supplyName: string;
483
505
  qty: number;
@@ -489,22 +511,23 @@ type TCheckOutItem = {
489
511
  updatedAt?: string;
490
512
  deletedAt?: string;
491
513
  };
492
- type TCheckOutItemCreate = Pick<TCheckOutItem, "site" | "supply" | "supplyName" | "qty" | "attachment" | "createdBy" | "createdByName">;
493
- type TCheckOutItemCreateService = Pick<TCheckOutItem, "site" | "supply" | "qty" | "attachment" | "createdBy">;
494
- type TCheckOutItemCreateByBatchService = Pick<TCheckOutItem, "site" | "createdBy"> & {
514
+ type TCheckOutItemCreate = Pick<TCheckOutItem, "site" | "serviceType" | "supply" | "supplyName" | "qty" | "attachment" | "createdBy" | "createdByName">;
515
+ type TCheckOutItemCreateService = Pick<TCheckOutItem, "site" | "serviceType" | "supply" | "qty" | "attachment" | "createdBy">;
516
+ type TCheckOutItemCreateByBatchService = Pick<TCheckOutItem, "site" | "serviceType" | "createdBy"> & {
495
517
  items: Pick<TCheckOutItem, "supply" | "qty" | "attachment">[];
496
518
  };
497
519
  type TCheckOutItemGetQuery = {
498
520
  page?: number;
499
521
  limit?: number;
500
522
  search?: string;
501
- } & Pick<TCheckOutItem, "site">;
502
- type TCheckOutItemGetById = Pick<TCheckOutItem, "_id" | "site" | "supply" | "supplyName" | "qty" | "status"> & {
523
+ } & Pick<TCheckOutItem, "site" | "serviceType">;
524
+ type TCheckOutItemGetById = Pick<TCheckOutItem, "_id" | "site" | "serviceType" | "supply" | "supplyName" | "qty" | "status"> & {
503
525
  unitOfMeasurement?: string;
504
526
  };
505
527
  declare const checkOutItemSchema: Joi.ObjectSchema<any>;
506
528
  declare function MCheckOutItem(value: TCheckOutItemCreate): {
507
529
  site: string | ObjectId;
530
+ serviceType: ServiceType;
508
531
  supply: string | ObjectId;
509
532
  supplyName: string;
510
533
  qty: number;
@@ -521,7 +544,7 @@ declare function useCheckOutItemRepository(): {
521
544
  createIndex: () => Promise<void>;
522
545
  createTextIndex: () => Promise<void>;
523
546
  createCheckOutItem: (value: TCheckOutItemCreate, session?: ClientSession) => Promise<ObjectId>;
524
- getCheckOutItems: ({ page, limit, search, site, }: TCheckOutItemGetQuery) => Promise<{}>;
547
+ getCheckOutItems: ({ page, limit, search, site, serviceType, }: TCheckOutItemGetQuery) => Promise<{}>;
525
548
  getCheckOutItemById: (_id: string | ObjectId, session?: ClientSession) => Promise<TCheckOutItemGetById>;
526
549
  completeCheckOutItem: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
527
550
  };
@@ -541,6 +564,7 @@ declare function useCheckOutItemController(): {
541
564
  type TScheduleTask = {
542
565
  _id?: ObjectId;
543
566
  site: string | ObjectId;
567
+ serviceType: TServiceType;
544
568
  title: string;
545
569
  time: string;
546
570
  dates: string[];
@@ -555,17 +579,18 @@ type TScheduleTask = {
555
579
  updatedAt?: string | Date;
556
580
  deletedAt?: string | Date;
557
581
  };
558
- type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "title" | "time" | "dates" | "description" | "areas" | "createdBy">;
582
+ type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas" | "createdBy">;
559
583
  type TScheduleTaskGetQuery = {
560
584
  page?: number;
561
585
  limit?: number;
562
586
  search?: string;
563
- } & Pick<TScheduleTask, "site">;
587
+ } & Pick<TScheduleTask, "site" | "serviceType">;
564
588
  type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "createdBy" | "createdAt">;
565
589
  type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas">>;
566
590
  declare const scheduleTaskSchema: Joi.ObjectSchema<any>;
567
591
  declare function MScheduleTask(value: TScheduleTaskCreate): {
568
592
  site: string | ObjectId;
593
+ serviceType: ServiceType;
569
594
  title: string;
570
595
  time: string;
571
596
  dates: string[];
@@ -585,15 +610,15 @@ declare function useScheduleTaskRepository(): {
585
610
  createIndex: () => Promise<void>;
586
611
  createTextIndex: () => Promise<void>;
587
612
  createScheduleTask: (value: TScheduleTaskCreate, session?: ClientSession) => Promise<ObjectId>;
588
- getScheduleTasks: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
613
+ getScheduleTasks: ({ page, limit, search, site, serviceType, }: TScheduleTaskGetQuery) => Promise<{}>;
589
614
  getAllScheduleTask: () => Promise<TScheduleTask[]>;
590
- getTasksForScheduleTask: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
591
615
  getScheduleTaskById: (_id: string | ObjectId, session?: ClientSession) => Promise<TScheduleTaskGetById>;
592
616
  updateScheduleTask: (_id: string | ObjectId, value: TScheduleTaskUpdate, session?: ClientSession) => Promise<number>;
617
+ deleteScheduleTask: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
593
618
  };
594
619
 
595
620
  declare function useScheduleTaskService(): {
596
- checkScheduleConditions: (schedule: any, currentDate?: Date) => boolean;
621
+ checkScheduleConditions: (schedule: any, serviceType: TServiceType, currentDate?: Date) => boolean;
597
622
  processScheduledTasks: (currentDate?: Date) => Promise<{
598
623
  processed: number;
599
624
  validated: number;
@@ -608,9 +633,9 @@ declare function useScheduleTaskService(): {
608
633
  declare function useScheduleTaskController(): {
609
634
  createScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
610
635
  getScheduleTasks: (req: Request, res: Response, next: NextFunction) => Promise<void>;
611
- getTasksForScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
612
636
  getScheduleTaskById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
613
637
  updateScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
638
+ deleteScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
614
639
  };
615
640
 
616
641
  declare function useQRService(): {