@7365admin1/module-hygiene 4.16.0 → 4.18.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 +12 -0
- package/dist/index.d.ts +36 -50
- package/dist/index.js +55 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,19 +2,9 @@ import * as mongodb from 'mongodb';
|
|
|
2
2
|
import { ObjectId, ClientSession } from 'mongodb';
|
|
3
3
|
import { Request, Response, NextFunction } from 'express';
|
|
4
4
|
import Joi from 'joi';
|
|
5
|
+
import { TAppServiceType, AppServiceType } from '@7365admin1/core';
|
|
5
6
|
import * as bson from 'bson';
|
|
6
7
|
|
|
7
|
-
declare enum ServiceType {
|
|
8
|
-
REAL_ESTATE_DEVELOPER = "real_estate_developer",
|
|
9
|
-
PROPERTY_MANAGEMENT_AGENCY = "property_management_agency",
|
|
10
|
-
SECURITY_AGENCY = "security_agency",
|
|
11
|
-
CLEANING_SERVICES = "cleaning_services",
|
|
12
|
-
MECHANICAL_ELECTRICAL_SERVICES = "mechanical_electrical_services",
|
|
13
|
-
LANDSCAPING_SERVICES = "landscaping_services",
|
|
14
|
-
PEST_CONTROL_SERVICES = "pest_control_services",
|
|
15
|
-
POOL_MAINTENANCE_SERVICES = "pool_maintenance_services"
|
|
16
|
-
}
|
|
17
|
-
type TServiceType = ServiceType;
|
|
18
8
|
declare const allowedTypes: string[];
|
|
19
9
|
declare const allowedStatus: string[];
|
|
20
10
|
declare const allowedPeriods: string[];
|
|
@@ -42,7 +32,7 @@ type TAreaUnits = {
|
|
|
42
32
|
type TArea = {
|
|
43
33
|
_id?: ObjectId;
|
|
44
34
|
site: string | ObjectId;
|
|
45
|
-
serviceType:
|
|
35
|
+
serviceType: TAppServiceType;
|
|
46
36
|
name: string;
|
|
47
37
|
type: (typeof allowedTypes)[number];
|
|
48
38
|
set?: number;
|
|
@@ -66,7 +56,7 @@ type TAreaUpdateChecklist = {
|
|
|
66
56
|
declare const areaSchema: Joi.ObjectSchema<any>;
|
|
67
57
|
declare function MArea(value: TAreaCreate): {
|
|
68
58
|
site: string | ObjectId;
|
|
69
|
-
serviceType:
|
|
59
|
+
serviceType: AppServiceType;
|
|
70
60
|
name: string;
|
|
71
61
|
type: string;
|
|
72
62
|
set: number;
|
|
@@ -83,7 +73,7 @@ declare function useAreaRepo(): {
|
|
|
83
73
|
createUniqueIndex: () => Promise<void>;
|
|
84
74
|
createArea: (value: TAreaCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
85
75
|
getAreas: ({ page, limit, search, type, site, serviceType, }: TAreaGetQuery) => Promise<{}>;
|
|
86
|
-
getAreasForChecklist: (site: string | ObjectId, serviceType:
|
|
76
|
+
getAreasForChecklist: (site: string | ObjectId, serviceType: TAppServiceType) => Promise<{}>;
|
|
87
77
|
getAreaById: (_id: string | ObjectId) => Promise<{}>;
|
|
88
78
|
verifyAreaByUnitId: (unitId: string | ObjectId) => Promise<{}>;
|
|
89
79
|
updateArea: (_id: string | ObjectId, value: TAreaUpdate, session?: ClientSession) => Promise<number>;
|
|
@@ -95,13 +85,13 @@ declare function useAreaService(): {
|
|
|
95
85
|
importArea: ({ dataJson, site, serviceType, }: {
|
|
96
86
|
dataJson: string;
|
|
97
87
|
site: string | ObjectId;
|
|
98
|
-
serviceType:
|
|
88
|
+
serviceType: TAppServiceType;
|
|
99
89
|
}) => Promise<{
|
|
100
90
|
message: string;
|
|
101
91
|
}>;
|
|
102
92
|
exportAreas: ({ site, serviceType, }: {
|
|
103
93
|
site: string | ObjectId;
|
|
104
|
-
serviceType:
|
|
94
|
+
serviceType: TAppServiceType;
|
|
105
95
|
}) => Promise<Buffer>;
|
|
106
96
|
};
|
|
107
97
|
|
|
@@ -127,7 +117,7 @@ declare function useAreaController(): {
|
|
|
127
117
|
type TUnit = {
|
|
128
118
|
_id?: ObjectId;
|
|
129
119
|
site: string | ObjectId;
|
|
130
|
-
serviceType:
|
|
120
|
+
serviceType: TAppServiceType;
|
|
131
121
|
name: string;
|
|
132
122
|
createdAt?: string;
|
|
133
123
|
updatedAt?: string;
|
|
@@ -135,19 +125,19 @@ type TUnit = {
|
|
|
135
125
|
status?: "active" | "deleted";
|
|
136
126
|
};
|
|
137
127
|
type TUnitCreate = {
|
|
138
|
-
serviceType:
|
|
128
|
+
serviceType: TAppServiceType;
|
|
139
129
|
} & Pick<TUnit, "site" | "name">;
|
|
140
130
|
type TUnitGetQuery = {
|
|
141
131
|
page?: number;
|
|
142
132
|
limit?: number;
|
|
143
133
|
search?: string;
|
|
144
|
-
serviceType:
|
|
134
|
+
serviceType: TAppServiceType;
|
|
145
135
|
} & Pick<TUnit, "site">;
|
|
146
136
|
type TUnitUpdate = Pick<TUnit, "name">;
|
|
147
137
|
declare const unitSchema: Joi.ObjectSchema<any>;
|
|
148
138
|
declare function MUnit(value: TUnitCreate): {
|
|
149
139
|
site: string | ObjectId;
|
|
150
|
-
serviceType:
|
|
140
|
+
serviceType: AppServiceType;
|
|
151
141
|
name: string;
|
|
152
142
|
status: string;
|
|
153
143
|
createdAt: Date;
|
|
@@ -159,7 +149,7 @@ declare function useUnitService(): {
|
|
|
159
149
|
importUnit: ({ dataJson, site, serviceType, }: {
|
|
160
150
|
dataJson: string;
|
|
161
151
|
site: string | ObjectId;
|
|
162
|
-
serviceType:
|
|
152
|
+
serviceType: TAppServiceType;
|
|
163
153
|
}) => Promise<{
|
|
164
154
|
message: string;
|
|
165
155
|
}>;
|
|
@@ -167,7 +157,7 @@ declare function useUnitService(): {
|
|
|
167
157
|
deleteUnit: (_id: string | ObjectId) => Promise<number>;
|
|
168
158
|
exportUnits: ({ site, serviceType, }: {
|
|
169
159
|
site: string | ObjectId;
|
|
170
|
-
serviceType:
|
|
160
|
+
serviceType: TAppServiceType;
|
|
171
161
|
}) => Promise<Buffer>;
|
|
172
162
|
};
|
|
173
163
|
|
|
@@ -193,18 +183,18 @@ declare function useUnitController(): {
|
|
|
193
183
|
type TParentChecklist = {
|
|
194
184
|
_id?: ObjectId;
|
|
195
185
|
site: string | ObjectId;
|
|
196
|
-
serviceType:
|
|
186
|
+
serviceType: TAppServiceType;
|
|
197
187
|
status?: (typeof allowedStatus)[number];
|
|
198
188
|
createdAt?: Date | string;
|
|
199
189
|
updatedAt?: Date | string;
|
|
200
190
|
};
|
|
201
191
|
type TParentChecklistCreate = {
|
|
202
192
|
site?: string | ObjectId;
|
|
203
|
-
serviceType?:
|
|
193
|
+
serviceType?: TAppServiceType;
|
|
204
194
|
} & Pick<TParentChecklist, "createdAt">;
|
|
205
195
|
type TParentChecklistGetQuery = {
|
|
206
196
|
site: string | ObjectId;
|
|
207
|
-
serviceType:
|
|
197
|
+
serviceType: TAppServiceType;
|
|
208
198
|
page?: number;
|
|
209
199
|
limit?: number;
|
|
210
200
|
search?: string;
|
|
@@ -214,7 +204,7 @@ type TParentChecklistGetQuery = {
|
|
|
214
204
|
declare const parentChecklistSchema: Joi.ObjectSchema<any>;
|
|
215
205
|
declare function MParentChecklist(value: TParentChecklist): {
|
|
216
206
|
site: string | ObjectId;
|
|
217
|
-
serviceType:
|
|
207
|
+
serviceType: AppServiceType;
|
|
218
208
|
status: string;
|
|
219
209
|
createdAt: string | Date;
|
|
220
210
|
updatedAt: string | Date;
|
|
@@ -250,13 +240,12 @@ declare const allowedChecklistStatus: string[];
|
|
|
250
240
|
type TCleaningScheduleArea = {
|
|
251
241
|
_id?: ObjectId;
|
|
252
242
|
schedule: string | ObjectId;
|
|
253
|
-
serviceType:
|
|
243
|
+
serviceType: TAppServiceType;
|
|
254
244
|
area: string | ObjectId;
|
|
255
245
|
name: string;
|
|
256
246
|
type: (typeof allowedTypes)[number];
|
|
257
247
|
checklist: TAreaChecklist[];
|
|
258
248
|
status?: (typeof allowedStatus)[number];
|
|
259
|
-
createdBy?: string | ObjectId;
|
|
260
249
|
createdAt?: Date | string;
|
|
261
250
|
completedAt?: Date | string;
|
|
262
251
|
updatedAt?: Date | string;
|
|
@@ -279,8 +268,8 @@ type TAreaChecklistUnits = {
|
|
|
279
268
|
completedBy?: string | ObjectId;
|
|
280
269
|
timestamp?: Date | string;
|
|
281
270
|
};
|
|
282
|
-
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "serviceType" | "area" | "name" | "type" | "checklist"
|
|
283
|
-
type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule"
|
|
271
|
+
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "serviceType" | "area" | "name" | "type" | "checklist">;
|
|
272
|
+
type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule"> & {
|
|
284
273
|
site: string | ObjectId;
|
|
285
274
|
};
|
|
286
275
|
type TCleaningScheduleAreaGetQuery = {
|
|
@@ -295,13 +284,12 @@ type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "approve" | "reject"
|
|
|
295
284
|
declare const areaChecklistSchema: Joi.ObjectSchema<any>;
|
|
296
285
|
declare function MAreaChecklist(value: TAreaChecklistCreate): {
|
|
297
286
|
schedule: string | ObjectId;
|
|
298
|
-
serviceType:
|
|
287
|
+
serviceType: AppServiceType;
|
|
299
288
|
area: string | ObjectId;
|
|
300
289
|
name: string;
|
|
301
290
|
type: string;
|
|
302
291
|
checklist: TAreaChecklist[];
|
|
303
292
|
status: string;
|
|
304
|
-
createdBy: string | ObjectId | undefined;
|
|
305
293
|
createdAt: Date;
|
|
306
294
|
completedAt: string;
|
|
307
295
|
updatedAt: string;
|
|
@@ -361,13 +349,13 @@ declare function useAreaChecklistRepo(): {
|
|
|
361
349
|
page?: number | undefined;
|
|
362
350
|
limit?: number | undefined;
|
|
363
351
|
search?: string | undefined;
|
|
364
|
-
serviceType:
|
|
352
|
+
serviceType: TAppServiceType;
|
|
365
353
|
_id: string | ObjectId;
|
|
366
354
|
}, session?: ClientSession) => Promise<{}>;
|
|
367
355
|
getAreaChecklistById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
|
|
368
356
|
getAreaChecklistByAreaAndSchedule: ({ schedule, serviceType, area, session, }: {
|
|
369
357
|
schedule: string | ObjectId;
|
|
370
|
-
serviceType:
|
|
358
|
+
serviceType: TAppServiceType;
|
|
371
359
|
area: string | ObjectId;
|
|
372
360
|
session?: ClientSession | undefined;
|
|
373
361
|
}) => Promise<mongodb.WithId<bson.Document>>;
|
|
@@ -377,8 +365,8 @@ declare function useAreaChecklistRepo(): {
|
|
|
377
365
|
updateAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate, session?: ClientSession) => Promise<number>;
|
|
378
366
|
getMaxSetNumberForArea: (areaId: string | ObjectId, session?: ClientSession) => Promise<any>;
|
|
379
367
|
closeExpiredAreaChecklists: () => Promise<number>;
|
|
380
|
-
pushScheduleTaskSets: (scheduleId: string | ObjectId, serviceType:
|
|
381
|
-
insertAutoGenSets: (scheduleId: string | ObjectId, serviceType:
|
|
368
|
+
pushScheduleTaskSets: (scheduleId: string | ObjectId, serviceType: TAppServiceType, areaId: string | ObjectId, scheduleTaskId: string | ObjectId, newSets: TAreaChecklist[]) => Promise<number>;
|
|
369
|
+
insertAutoGenSets: (scheduleId: string | ObjectId, serviceType: TAppServiceType, areaId: string | ObjectId, newSets: any[]) => Promise<number>;
|
|
382
370
|
trimOverflowSets: () => Promise<number>;
|
|
383
371
|
};
|
|
384
372
|
|
|
@@ -395,7 +383,7 @@ declare function useAreaChecklistController(): {
|
|
|
395
383
|
type TSupply = {
|
|
396
384
|
_id?: ObjectId;
|
|
397
385
|
site: string | ObjectId;
|
|
398
|
-
serviceType:
|
|
386
|
+
serviceType: TAppServiceType;
|
|
399
387
|
name: string;
|
|
400
388
|
unitOfMeasurement: string;
|
|
401
389
|
qty: number;
|
|
@@ -415,7 +403,7 @@ type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">
|
|
|
415
403
|
declare const supplySchema: Joi.ObjectSchema<any>;
|
|
416
404
|
declare function MSupply(value: TSupplyCreate): {
|
|
417
405
|
site: string | ObjectId;
|
|
418
|
-
serviceType:
|
|
406
|
+
serviceType: AppServiceType;
|
|
419
407
|
name: string;
|
|
420
408
|
unitOfMeasurement: string;
|
|
421
409
|
qty: number;
|
|
@@ -447,7 +435,7 @@ declare function useSupplyController(): {
|
|
|
447
435
|
type TStock = {
|
|
448
436
|
_id?: ObjectId;
|
|
449
437
|
site: string | ObjectId;
|
|
450
|
-
serviceType:
|
|
438
|
+
serviceType: TAppServiceType;
|
|
451
439
|
supply: string | ObjectId;
|
|
452
440
|
in?: number;
|
|
453
441
|
out?: number;
|
|
@@ -470,7 +458,7 @@ type TGetStocksQuery = {
|
|
|
470
458
|
declare const stockSchema: Joi.ObjectSchema<any>;
|
|
471
459
|
declare function MStock(value: TStockCreate): {
|
|
472
460
|
site: string | ObjectId;
|
|
473
|
-
serviceType:
|
|
461
|
+
serviceType: AppServiceType;
|
|
474
462
|
supply: string | ObjectId;
|
|
475
463
|
in: number;
|
|
476
464
|
out: number;
|
|
@@ -501,7 +489,7 @@ declare const allowedCheckOutItemStatus: string[];
|
|
|
501
489
|
type TCheckOutItem = {
|
|
502
490
|
_id?: ObjectId;
|
|
503
491
|
site: string | ObjectId;
|
|
504
|
-
serviceType:
|
|
492
|
+
serviceType: TAppServiceType;
|
|
505
493
|
supply: string | ObjectId;
|
|
506
494
|
supplyName: string;
|
|
507
495
|
qty: number;
|
|
@@ -529,7 +517,7 @@ type TCheckOutItemGetById = Pick<TCheckOutItem, "_id" | "site" | "serviceType" |
|
|
|
529
517
|
declare const checkOutItemSchema: Joi.ObjectSchema<any>;
|
|
530
518
|
declare function MCheckOutItem(value: TCheckOutItemCreate): {
|
|
531
519
|
site: string | ObjectId;
|
|
532
|
-
serviceType:
|
|
520
|
+
serviceType: AppServiceType;
|
|
533
521
|
supply: string | ObjectId;
|
|
534
522
|
supplyName: string;
|
|
535
523
|
qty: number;
|
|
@@ -566,7 +554,7 @@ declare function useCheckOutItemController(): {
|
|
|
566
554
|
type TScheduleTask = {
|
|
567
555
|
_id?: ObjectId;
|
|
568
556
|
site: string | ObjectId;
|
|
569
|
-
serviceType:
|
|
557
|
+
serviceType: TAppServiceType;
|
|
570
558
|
title: string;
|
|
571
559
|
time: string;
|
|
572
560
|
dates: string[];
|
|
@@ -576,23 +564,22 @@ type TScheduleTask = {
|
|
|
576
564
|
value: ObjectId;
|
|
577
565
|
}[];
|
|
578
566
|
status?: "active" | "deleted";
|
|
579
|
-
createdBy: string | ObjectId;
|
|
580
567
|
createdAt?: string | Date;
|
|
581
568
|
updatedAt?: string | Date;
|
|
582
569
|
deletedAt?: string | Date;
|
|
583
570
|
};
|
|
584
|
-
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas"
|
|
571
|
+
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "serviceType" | "title" | "time" | "dates" | "description" | "areas">;
|
|
585
572
|
type TScheduleTaskGetQuery = {
|
|
586
573
|
page?: number;
|
|
587
574
|
limit?: number;
|
|
588
575
|
search?: string;
|
|
589
576
|
} & Pick<TScheduleTask, "site" | "serviceType">;
|
|
590
|
-
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "
|
|
577
|
+
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas" | "status" | "createdAt">;
|
|
591
578
|
type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "time" | "dates" | "description" | "areas">>;
|
|
592
579
|
declare const scheduleTaskSchema: Joi.ObjectSchema<any>;
|
|
593
580
|
declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
594
581
|
site: string | ObjectId;
|
|
595
|
-
serviceType:
|
|
582
|
+
serviceType: AppServiceType;
|
|
596
583
|
title: string;
|
|
597
584
|
time: string;
|
|
598
585
|
dates: string[];
|
|
@@ -602,7 +589,6 @@ declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
|
602
589
|
value: ObjectId;
|
|
603
590
|
}[];
|
|
604
591
|
status: string;
|
|
605
|
-
createdBy: string | ObjectId;
|
|
606
592
|
createdAt: Date;
|
|
607
593
|
updatedAt: string;
|
|
608
594
|
deletedAt: string;
|
|
@@ -620,7 +606,7 @@ declare function useScheduleTaskRepository(): {
|
|
|
620
606
|
};
|
|
621
607
|
|
|
622
608
|
declare function useScheduleTaskService(): {
|
|
623
|
-
checkScheduleConditions: (schedule: any, serviceType:
|
|
609
|
+
checkScheduleConditions: (schedule: any, serviceType: TAppServiceType, currentDate?: Date) => boolean;
|
|
624
610
|
processScheduledTasks: (currentDate?: Date) => Promise<{
|
|
625
611
|
processed: number;
|
|
626
612
|
validated: number;
|
|
@@ -649,4 +635,4 @@ declare function useQRController(): {
|
|
|
649
635
|
generateQR: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
650
636
|
};
|
|
651
637
|
|
|
652
|
-
export { MArea, MAreaChecklist, MCheckOutItem, MParentChecklist, MScheduleTask, MStock, MSupply, MUnit,
|
|
638
|
+
export { MArea, MAreaChecklist, MCheckOutItem, MParentChecklist, MScheduleTask, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistBatchCreate, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaChecklistUpdate, TAreaCreate, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCheckOutItem, TCheckOutItemCreate, TCheckOutItemCreateByBatchService, TCheckOutItemCreateService, TCheckOutItemGetById, TCheckOutItemGetQuery, TCleaningScheduleArea, TCleaningScheduleAreaGetQuery, TGetStocksQuery, TParentChecklist, TParentChecklistCreate, TParentChecklistGetQuery, TScheduleTask, TScheduleTaskCreate, TScheduleTaskGetById, TScheduleTaskGetQuery, TScheduleTaskUpdate, TStock, TStockCreate, TStockCreateService, TSupply, TSupplyCreate, TSupplyGetById, TSupplyGetQuery, TSupplyUpdate, TUnit, TUnitCreate, TUnitGetQuery, TUnitUpdate, allowedCheckOutItemStatus, allowedChecklistStatus, allowedPeriods, allowedStatus, allowedTypes, areaChecklistSchema, areaSchema, checkOutItemSchema, parentChecklistSchema, scheduleTaskSchema, stockSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaExportService, useAreaRepo, useAreaService, useCheckOutItemController, useCheckOutItemRepository, useCheckOutItemService, useHygieneDashboardController, useHygieneDashboardRepository, useParentChecklistController, useParentChecklistRepo, useQRController, useQRService, useScheduleTaskController, useScheduleTaskRepository, useScheduleTaskService, useStockController, useStockRepository, useStockService, useSupplyController, useSupplyRepository, useUnitController, useUnitExportService, useUnitRepository, useUnitService };
|