@iservice365/module-hygiene 0.1.2 → 1.0.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/dist/index.d.ts CHANGED
@@ -1,62 +1,69 @@
1
1
  import Joi from 'joi';
2
2
  import * as mongodb from 'mongodb';
3
3
  import { ObjectId, ClientSession } from 'mongodb';
4
- import * as bson from 'bson';
5
4
  import { Request, Response, NextFunction } from 'express';
5
+ import * as bson from 'bson';
6
+
7
+ declare const allowedTypes: string[];
8
+ declare const allowedStatus: string[];
6
9
 
7
- interface TManageAreaChecklist {
8
- _id: string | ObjectId;
10
+ type TAreaUnits = {
11
+ unit: string | ObjectId;
9
12
  name: string;
10
- }
13
+ };
11
14
  type TArea = {
12
15
  _id?: ObjectId;
16
+ site: string | ObjectId;
13
17
  name: string;
14
- site?: string | ObjectId;
15
- createdBy?: string | ObjectId;
16
- checklist?: TManageAreaChecklist[];
17
- status?: string;
18
+ type: (typeof allowedTypes)[number];
19
+ set?: number;
20
+ units?: TAreaUnits[];
21
+ status?: "active" | "deleted";
18
22
  createdAt?: Date | string;
19
23
  updatedAt?: Date | string;
20
24
  deletedAt?: Date | string;
21
25
  };
22
- type TAreaUpdate = Pick<TArea, "name">;
23
- type TAreaUpdateChecklist = NonNullable<Pick<TArea, "checklist">>;
26
+ type TAreaGetQuery = {
27
+ page?: number;
28
+ limit?: number;
29
+ search?: string;
30
+ } & Pick<TArea, "site">;
31
+ type TAreaCreate = Pick<TArea, "site" | "name" | "type" | "set" | "units">;
32
+ type TAreaUpdate = Partial<Pick<TArea, "name" | "type" | "set" | "units">>;
33
+ type TAreaGetAreasForChecklist = Pick<TArea, "site" | "type">;
34
+ type TAreaUpdateChecklist = {
35
+ units: TAreaUnits[];
36
+ };
24
37
  declare const areaSchema: Joi.ObjectSchema<any>;
25
- declare function MArea(value: TArea): {
38
+ declare function MArea(value: TAreaCreate): {
39
+ site: string | ObjectId;
26
40
  name: string;
27
- site: string | ObjectId | undefined;
28
- createdBy: string | ObjectId | undefined;
29
- checklist: TManageAreaChecklist[] | undefined;
41
+ type: string;
42
+ set: number;
43
+ units: TAreaUnits[];
30
44
  status: string;
31
45
  createdAt: Date;
32
- updatedAt: string | Date;
33
- deletedAt: string | Date;
46
+ updatedAt: string;
47
+ deletedAt: string;
34
48
  };
35
49
 
36
- declare function useAreaRepository(): {
50
+ declare function useAreaRepo(): {
37
51
  createIndex: () => Promise<void>;
38
52
  createTextIndex: () => Promise<void>;
39
53
  createUniqueIndex: () => Promise<void>;
40
- createArea: (value: TArea, session?: ClientSession) => Promise<ObjectId>;
41
- getAreas: ({ page, limit, search, startDate, endDate, site, }: {
42
- page?: number | undefined;
43
- limit?: number | undefined;
44
- search?: string | undefined;
45
- startDate?: string | Date | undefined;
46
- endDate?: string | Date | undefined;
47
- site?: string | ObjectId | undefined;
48
- }) => Promise<{}>;
54
+ createArea: (value: TAreaCreate, session?: ClientSession) => Promise<ObjectId>;
55
+ getAreas: ({ page, limit, search, site, }: TAreaGetQuery) => Promise<{}>;
56
+ getAreasForChecklist: ({ site, type, }: TAreaGetAreasForChecklist) => Promise<{}>;
49
57
  getAreaById: (_id: string | ObjectId) => Promise<{}>;
50
- getAreaByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
51
- updateArea: (_id: string | ObjectId, value: TAreaUpdate) => Promise<number>;
52
- updateAreaChecklist: (_id: string | ObjectId, value: TAreaUpdateChecklist) => Promise<number>;
58
+ verifyAreaByUnitId: (unitId: string | ObjectId) => Promise<{}>;
59
+ updateArea: (_id: string | ObjectId, value: TAreaUpdate, session?: ClientSession) => Promise<number>;
60
+ updateAreaChecklist: (unitId: string | ObjectId, name: string, session?: ClientSession) => Promise<number>;
53
61
  deleteArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
54
62
  };
55
63
 
56
64
  declare function useAreaService(): {
57
- uploadByFile: ({ dataJson, createdBy, site, }: {
65
+ importArea: ({ dataJson, site, }: {
58
66
  dataJson: string;
59
- createdBy: string | ObjectId;
60
67
  site: string | ObjectId;
61
68
  }) => Promise<{
62
69
  message: string;
@@ -74,342 +81,177 @@ interface MulterRequest extends Request {
74
81
 
75
82
  declare function useAreaController(): {
76
83
  createArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
77
- getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
84
+ getAreas: (req: Request, res: Response, next: NextFunction) => Promise<void>;
78
85
  getAreaById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
79
86
  updateArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
80
- updateAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
81
87
  deleteArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
82
- uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
88
+ importArea: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
83
89
  };
84
90
 
85
- interface TToiletLocationChecklist {
86
- _id: string | ObjectId;
87
- name: string;
88
- }
89
- interface TGetToiletLocationsQuery {
90
- page?: number;
91
- limit?: number;
92
- search?: string;
93
- sort?: Record<string, any>;
94
- startDate?: Date | string;
95
- endDate?: Date | string;
96
- site: ObjectId | string;
97
- }
98
- type TToiletLocation = {
91
+ type TUnit = {
99
92
  _id?: ObjectId;
100
- name: string;
101
- createdBy?: string | ObjectId;
102
- checklist?: TToiletLocationChecklist[];
103
- status?: string;
104
- site?: string | ObjectId;
105
- createdAt?: string | Date;
106
- updatedAt?: string | Date;
107
- deletedAt?: Date | string;
108
- };
109
- type TToiletUpdateChecklist = NonNullable<Pick<TToiletLocation, "checklist">>;
110
- declare const toiletLocationSchema: Joi.ObjectSchema<any>;
111
- declare function MToiletLocation(value: TToiletLocation): {
112
- name: string;
113
- site: string | ObjectId | undefined;
114
- createdBy: string | ObjectId | undefined;
115
- checklist: TToiletLocationChecklist[] | undefined;
116
- status: string;
117
- createdAt: Date;
118
- updatedAt: string | Date;
119
- deletedAt: string | Date;
120
- };
121
-
122
- declare function useToiletLocationRepository(): {
123
- createIndexes: () => Promise<void>;
124
- createUniqueIndex: () => Promise<void>;
125
- getToiletLocations: ({ page, limit, search, sort, startDate, endDate, site, }: {
126
- page?: number | undefined;
127
- limit?: number | undefined;
128
- search?: string | undefined;
129
- sort?: Record<string, any> | undefined;
130
- startDate?: string | Date | undefined;
131
- endDate?: string | Date | undefined;
132
- site?: string | ObjectId | undefined;
133
- }) => Promise<{}>;
134
- create: (value: TToiletLocation, session?: ClientSession) => Promise<ObjectId>;
135
- updateToiletLocation: (_id: string | ObjectId, value: TToiletLocation) => Promise<number>;
136
- deleteToiletLocation: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
137
- getToiletLocationByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
138
- getToiletLocationById: (_id: string | ObjectId) => Promise<{}>;
139
- updateToiletLocationChecklist: (_id: string | ObjectId, value: TToiletUpdateChecklist) => Promise<number>;
140
- };
141
-
142
- declare function useToiletLocationService(): {
143
- uploadByFile: ({ dataJson, createdBy, site, }: {
144
- dataJson: string;
145
- createdBy: string | ObjectId;
146
- site: string | ObjectId;
147
- }) => Promise<{
148
- message: string;
149
- }>;
150
- };
151
-
152
- declare function useToiletLocationController(): {
153
- getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
154
- createToiletLocation: (req: Request, res: Response, next: NextFunction) => Promise<void>;
155
- updateToiletLocation: (req: Request, res: Response, next: NextFunction) => Promise<void>;
156
- deleteToiletLocation: (req: Request, res: Response, next: NextFunction) => Promise<void>;
157
- updateToiletLocationChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
158
- getToiletLocationById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
159
- uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
160
- };
161
-
162
- declare const allowedTypes: string[];
163
- declare const allowedStatus: string[];
164
- interface TParentChecklistStatus {
165
- type: (typeof allowedTypes)[number];
166
93
  site: string | ObjectId;
167
- status: (typeof allowedStatus)[number];
168
- completedAt: string | Date;
169
- }
170
- type TParentChecklist = {
171
- _id?: ObjectId;
172
- date: Date;
173
- status?: TParentChecklistStatus[];
174
- createdAt?: Date | string;
175
- updatedAt?: Date | string;
176
- deletedAt?: Date | string;
177
- };
178
- declare const parentChecklistSchema: Joi.ObjectSchema<any>;
179
- declare function MParentChecklist(value: TParentChecklist): {
180
- date: Date;
181
- status: TParentChecklistStatus[] | undefined;
182
- createdAt: Date;
183
- updatedAt: string | Date;
184
- };
185
-
186
- declare function useParentChecklistRepo(): {
187
- createIndex: () => Promise<void>;
188
- createParentChecklist: (value: TParentChecklist, session?: ClientSession) => Promise<ObjectId>;
189
- getAllParentChecklist: ({ page, limit, search, site, type, startDate, endDate, }: {
190
- page?: number | undefined;
191
- limit?: number | undefined;
192
- search?: string | undefined;
193
- site: ObjectId | string;
194
- type: (typeof allowedTypes)[number];
195
- startDate?: string | Date | undefined;
196
- endDate?: string | Date | undefined;
197
- }) => Promise<{}>;
198
- updateParentChecklistStatuses: (date?: Date) => Promise<mongodb.BulkWriteResult | null>;
199
- };
200
-
201
- declare function useParentChecklistController(): {
202
- createParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
203
- getAllParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
204
- };
205
-
206
- interface TUnit {
207
- _id?: ObjectId;
208
94
  name: string;
209
- site?: string | ObjectId;
210
- createdBy?: string | ObjectId;
211
- status?: string;
212
- createdAt?: string | Date;
213
- updatedAt?: string | Date;
214
- deletedAt?: string | Date;
215
- }
216
- type TUnitUpdate = Partial<Pick<TUnit, "name">>;
217
- interface TGetUnitsQuery {
95
+ createdAt?: string;
96
+ updatedAt?: string;
97
+ deletedAt?: string;
98
+ status?: "active" | "deleted";
99
+ };
100
+ type TUnitCreate = Partial<Pick<TUnit, "site" | "name">>;
101
+ type TUnitUpdate = Pick<TUnit, "name">;
102
+ type TGetUnitsQuery = {
218
103
  page?: number;
219
104
  limit?: number;
220
105
  search?: string;
221
- startDate?: Date | string;
222
- endDate?: Date | string;
223
- site: ObjectId | string;
224
- }
106
+ } & Pick<TUnit, "site">;
225
107
  declare const unitSchema: Joi.ObjectSchema<any>;
226
- declare function MUnit(value: TUnit): {
227
- name: string;
228
- createdBy: string | ObjectId | undefined;
108
+ declare function MUnit(value: TUnitCreate): {
229
109
  site: string | ObjectId | undefined;
230
- status: string;
110
+ name: string | undefined;
231
111
  createdAt: Date;
232
- updatedAt: string | Date;
233
- deletedAt: string | Date;
112
+ status: string;
113
+ updatedAt: string;
114
+ deletedAt: string;
234
115
  };
235
116
 
236
117
  declare function useUnitService(): {
237
- uploadByFile: ({ dataJson, createdBy, site, }: {
118
+ importUnit: ({ dataJson, site, }: {
238
119
  dataJson: string;
239
- createdBy: string | ObjectId;
240
120
  site: string | ObjectId;
241
121
  }) => Promise<{
242
122
  message: string;
243
123
  }>;
124
+ updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
125
+ deleteUnit: (_id: string | ObjectId) => Promise<number>;
244
126
  };
245
127
 
246
128
  declare function useUnitRepository(): {
247
129
  createIndex: () => Promise<void>;
248
130
  createTextIndex: () => Promise<void>;
249
131
  createUniqueIndex: () => Promise<void>;
250
- createUnit: (value: TUnit, session?: ClientSession) => Promise<ObjectId>;
251
- getUnits: ({ page, limit, search, startDate, endDate, site, }: TGetUnitsQuery) => Promise<{}>;
252
- getUnitByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
253
- getUnitById: (id: string | ObjectId, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
254
- updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
132
+ createUnit: (value: TUnitCreate, session?: ClientSession) => Promise<ObjectId>;
133
+ getUnits: ({ page, limit, search, site, }: TGetUnitsQuery) => Promise<{}>;
134
+ updateUnit: (_id: string | ObjectId, value: TUnitUpdate, session?: ClientSession) => Promise<number>;
255
135
  deleteUnit: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
256
136
  };
257
137
 
258
138
  declare function useUnitController(): {
259
139
  createUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
260
- getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
140
+ getUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
261
141
  updateUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
262
142
  deleteUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
263
- uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
143
+ importUnit: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
264
144
  };
265
145
 
266
- interface TScheduleTaskAreaCheckList {
267
- _id: string | ObjectId;
268
- name: string;
269
- }
270
- interface TGetScheduleTaskAreasQuery {
271
- page?: number;
272
- limit?: number;
273
- search?: string;
274
- sort?: Record<string, any>;
275
- startDate?: Date | string;
276
- endDate?: Date | string;
277
- site: ObjectId | string;
278
- }
279
- type TScheduleTaskArea = {
146
+ type TParentChecklist = {
280
147
  _id?: ObjectId;
281
- name: string;
282
148
  site?: string | ObjectId;
283
- createdBy?: string | ObjectId;
284
- checklist?: TScheduleTaskAreaCheckList[];
285
- status?: string;
149
+ status?: (typeof allowedStatus)[number];
286
150
  createdAt?: Date | string;
287
151
  updatedAt?: Date | string;
288
- deletedAt?: Date | string;
289
152
  };
290
- declare const scheduleTaskAreaSchema: Joi.ObjectSchema<any>;
291
- declare function MScheduleTaskArea(value: TScheduleTaskArea): {
292
- name: string;
153
+ declare const parentChecklistSchema: Joi.ObjectSchema<any>;
154
+ declare function MParentChecklist(value: TParentChecklist): {
293
155
  site: string | ObjectId | undefined;
294
- createdBy: string | ObjectId | undefined;
295
- checklist: TScheduleTaskAreaCheckList[] | undefined;
296
156
  status: string;
297
- createdAt: Date;
157
+ createdAt: string | Date;
298
158
  updatedAt: string | Date;
299
- deletedAt: string | Date;
300
159
  };
301
160
 
302
- declare function useScheduleTaskAreaRepository(): {
303
- createUniqueIndex: () => Promise<void>;
304
- createScheduleTaskArea: (value: TScheduleTaskArea, session?: ClientSession) => Promise<ObjectId>;
305
- updateScheduleTaskArea: (_id: string | ObjectId, params: TScheduleTaskArea) => Promise<number>;
306
- deleteScheduleTaskArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
307
- getScheduleTaskAreas: ({ page, limit, search, startDate, endDate, site, }: {
161
+ declare function useParentChecklistRepo(): {
162
+ createIndex: () => Promise<void>;
163
+ createParentChecklist: (value: TParentChecklist, session?: ClientSession) => Promise<ObjectId | ObjectId[]>;
164
+ getAllParentChecklist: ({ page, limit, search, site, startDate, endDate, }: {
308
165
  page?: number | undefined;
309
166
  limit?: number | undefined;
310
167
  search?: string | undefined;
168
+ site: ObjectId | string;
311
169
  startDate?: string | Date | undefined;
312
170
  endDate?: string | Date | undefined;
313
- site?: string | ObjectId | undefined;
314
171
  }) => Promise<{}>;
315
- createIndexes: () => Promise<void>;
316
- getScheduleTaskAreaByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
317
- getScheduleTaskAreaById: (id: string | ObjectId, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
318
- getAreaById: (_id: string | ObjectId) => Promise<{}>;
172
+ updateParentChecklistStatuses: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
319
173
  };
320
174
 
321
- declare function useScheduleTaskAreaService(): {
322
- uploadByFile: ({ dataJson, createdBy, site, }: {
323
- dataJson: string;
324
- createdBy: string | ObjectId;
325
- site: string | ObjectId;
326
- }) => Promise<{
327
- message: string;
328
- }>;
329
- };
330
-
331
- declare function useScheduleTaskAreaController(): {
332
- getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
333
- getAreaById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
334
- createScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
335
- updateScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
336
- deleteScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
337
- uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
175
+ declare function useParentChecklistController(): {
176
+ createParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
177
+ getAllParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
338
178
  };
339
179
 
340
- type TAreaChecklist = {
180
+ declare const allowedChecklistStatus: string[];
181
+ type TCleaningScheduleArea = {
341
182
  _id?: ObjectId;
183
+ schedule: string | ObjectId;
184
+ name: string;
342
185
  type: (typeof allowedTypes)[number];
343
- site: string | ObjectId;
344
- parentChecklist: string | ObjectId;
345
- area: string | ObjectId;
346
- name?: string;
347
- metadata?: TAreaChecklistMetadata;
186
+ checklist: TAreaChecklist[];
348
187
  status?: (typeof allowedStatus)[number];
349
- createdBy?: string | ObjectId;
350
188
  createdAt?: Date | string;
351
- acceptedBy?: string | ObjectId;
352
- acceptedAt?: Date | string;
353
- startedAt?: Date | string;
354
- endedAt?: Date | string;
355
- signature?: string;
189
+ completedAt?: Date | string;
356
190
  updatedAt?: Date | string;
357
191
  };
358
- type TAreaChecklistMetadata = {
359
- attachments?: string[];
192
+ type TAreaChecklist = {
193
+ set: number;
194
+ units: TAreaChecklistUnits[];
360
195
  };
361
- type TAreaChecklistCreate = Pick<TAreaChecklist, "type" | "site" | "parentChecklist" | "createdBy"> & {
362
- areas: Array<{
363
- area: string | ObjectId;
364
- name?: string;
365
- }>;
196
+ type TAreaChecklistUnits = {
197
+ unit: string | ObjectId;
198
+ name: string;
199
+ status?: (typeof allowedChecklistStatus)[number];
200
+ remarks?: string;
201
+ completedBy?: string | ObjectId;
202
+ timestamp?: Date | string;
366
203
  };
367
- declare const areaChecklistSchema: Joi.ObjectSchema<any>;
368
- declare function MAreaChecklist(value: TAreaChecklist): {
369
- type: string;
204
+ type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule"> & {
370
205
  site: string | ObjectId;
371
- parentChecklist: string | ObjectId;
372
- area: string | ObjectId;
206
+ };
207
+ type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "remarks" | "completedBy">;
208
+ declare const areaChecklistSchema: Joi.ObjectSchema<any>;
209
+ declare function MAreaChecklist(value: TCleaningScheduleArea): {
210
+ schedule: string | ObjectId;
373
211
  name: string;
212
+ type: string;
213
+ checklist: TAreaChecklist[];
374
214
  status: string;
375
- createdBy: string | ObjectId;
376
215
  createdAt: Date;
377
- acceptedBy: string | ObjectId;
378
- acceptedAt: string | Date;
379
- startedAt: string | Date;
380
- endedAt: string | Date;
381
- signature: string;
382
- updatedAt: string | Date;
216
+ completedAt: string;
217
+ updatedAt: string;
218
+ };
219
+
220
+ declare function useAreaChecklistService(): {
221
+ createAreaChecklist: (value: TAreaChecklistCreate) => Promise<ObjectId[]>;
222
+ completeAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate) => Promise<void>;
383
223
  };
384
224
 
385
225
  declare function useAreaChecklistRepo(): {
386
226
  createIndex: () => Promise<void>;
387
227
  createTextIndex: () => Promise<void>;
388
- createAreaChecklist: (value: TAreaChecklist, session?: ClientSession) => Promise<ObjectId>;
389
- getAllAreaChecklist: ({ page, limit, search, site, type, parentChecklist, }: {
228
+ createAreaChecklist: (value: TCleaningScheduleArea, session?: ClientSession) => Promise<ObjectId>;
229
+ getAllAreaChecklist: ({ page, limit, search, type, schedule, }: {
390
230
  page?: number | undefined;
391
231
  limit?: number | undefined;
392
232
  search?: string | undefined;
393
- site: string | ObjectId;
394
- type: (typeof allowedTypes)[number];
395
- parentChecklist: string | ObjectId;
396
- }) => Promise<{}>;
397
- getAreaChecklistHistory: ({ page, limit, search, site, type, parentChecklist, status, createdAt, user, }: {
233
+ type?: string | undefined;
234
+ schedule: string | ObjectId;
235
+ }, session?: ClientSession) => Promise<{}>;
236
+ getAreaChecklistHistory: ({ page, limit, search, type, schedule, status, createdAt, }: {
398
237
  page?: number | undefined;
399
238
  limit?: number | undefined;
400
239
  search?: string | undefined;
401
- site: string | ObjectId;
402
- type: (typeof allowedTypes)[number];
403
- parentChecklist: string | ObjectId;
240
+ type?: string | undefined;
241
+ schedule: string | ObjectId;
404
242
  status?: string | undefined;
405
243
  createdAt?: string | Date | undefined;
406
- user?: string | ObjectId | undefined;
407
244
  }) => Promise<{}>;
408
245
  getAreaChecklistHistoryDetails: (_id: string | ObjectId) => Promise<{}>;
409
- acceptAreaChecklist: (_id: string | ObjectId, acceptedBy: string | ObjectId) => Promise<number>;
410
- attachImageAreaChecklist: (_id: string | ObjectId, attachments: string[], session?: ClientSession) => Promise<number>;
411
- submitAreaChecklist: (_id: string | ObjectId, signature: string) => Promise<number>;
412
- completeAreaChecklist: (_id: string | ObjectId, signature: string) => Promise<number>;
246
+ getAreaChecklistUnits: ({ page, limit, search, _id, }: {
247
+ page?: number | undefined;
248
+ limit?: number | undefined;
249
+ search?: string | undefined;
250
+ _id: string | ObjectId;
251
+ }, session?: ClientSession) => Promise<{}>;
252
+ getAreaChecklistById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
253
+ updateAreaChecklistStatus: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
254
+ completeAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate, session?: ClientSession) => Promise<number>;
413
255
  };
414
256
 
415
257
  declare function useAreaChecklistController(): {
@@ -417,88 +259,55 @@ declare function useAreaChecklistController(): {
417
259
  getAllAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
418
260
  getAreaChecklistHistory: (req: Request, res: Response, next: NextFunction) => Promise<void>;
419
261
  getAreaChecklistHistoryDetails: (req: Request, res: Response, next: NextFunction) => Promise<void>;
420
- acceptAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
421
- attachImageAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
422
- submitAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
423
- completeAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
262
+ getAreaChecklistUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
263
+ completeAreaChecklistUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
424
264
  };
425
265
 
426
- type TUnitChecklistMetadataWorkOrder = {
427
- attachments?: Array<string>;
428
- subject: string;
429
- category: string | ObjectId;
430
- highPriority?: boolean;
431
- block?: string;
432
- level?: string;
433
- unit?: string;
434
- location?: string;
435
- description: string;
436
- createdBy: string | ObjectId;
437
- createdByName?: string;
438
- serviceProvider?: string | ObjectId;
439
- organization?: string | ObjectId;
440
- site?: string | ObjectId;
441
- };
442
- type TUnitChecklistMetadata = {
443
- attachments?: string[];
444
- remarks?: string;
445
- workOrder?: TUnitChecklistMetadataWorkOrder;
446
- };
447
- type TUnitChecklist = {
266
+ type TSupply = {
448
267
  _id?: ObjectId;
449
268
  site: string | ObjectId;
450
- type: (typeof allowedTypes)[number];
451
- parentChecklist: string | ObjectId;
452
- areaChecklist: string | ObjectId;
453
- unit: ObjectId;
454
- name?: string;
455
- approve?: boolean;
456
- reject?: boolean;
457
- checkedBy?: string | ObjectId;
458
- metadata?: TUnitChecklistMetadata;
459
- createdBy?: string | ObjectId;
460
- createdAt?: Date | string;
461
- updatedAt?: Date | string;
462
- };
463
- type TUnitChecklistApprove = Partial<Pick<TUnitChecklist, "approve" | "reject" | "checkedBy">>;
464
- type TUnitChecklistReject = Partial<Pick<TUnitChecklist, "approve" | "reject" | "checkedBy" | "metadata">>;
465
- declare const unitChecklistSchema: Joi.ObjectSchema<any>;
466
- declare function MUnitChecklist(value: TUnitChecklist): {
269
+ name: string;
270
+ unitOfMeasurement: string;
271
+ qty: number;
272
+ createdAt?: string;
273
+ updatedAt?: string;
274
+ deletedAt?: string;
275
+ status?: "active" | "deleted";
276
+ };
277
+ type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement" | "qty">;
278
+ type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
279
+ type TGetSupplysQuery = {
280
+ page?: number;
281
+ limit?: number;
282
+ search?: string;
283
+ } & Pick<TSupply, "site">;
284
+ declare const supplySchema: Joi.ObjectSchema<any>;
285
+ declare function MSupply(value: TSupplyCreate): {
467
286
  site: string | ObjectId;
468
- type: string;
469
- parentChecklist: string | ObjectId;
470
- areaChecklist: string | ObjectId;
471
- unit: ObjectId;
472
287
  name: string;
473
- approve: boolean;
474
- reject: boolean;
475
- createdBy: string | ObjectId;
288
+ unitOfMeasurement: string;
289
+ qty: number;
476
290
  createdAt: Date;
477
- updatedAt: string | Date;
291
+ status: string;
292
+ updatedAt: string;
293
+ deletedAt: string;
478
294
  };
479
295
 
480
- declare function useUnitChecklistRepo(): {
296
+ declare function useSupplyRepository(): {
481
297
  createIndex: () => Promise<void>;
482
298
  createTextIndex: () => Promise<void>;
483
- createUnitChecklist: (value: TUnitChecklist, session?: ClientSession) => Promise<ObjectId>;
484
- getAllUnitChecklist: ({ page, limit, search, site, type, parentChecklist, areaChecklist, }: {
485
- page?: number | undefined;
486
- limit?: number | undefined;
487
- search?: string | undefined;
488
- site: string | ObjectId;
489
- type: (typeof allowedTypes)[number];
490
- parentChecklist: string | ObjectId;
491
- areaChecklist: string | ObjectId;
492
- }) => Promise<{}>;
493
- getUnitChecklistById: (_id: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
494
- updateUnitChecklist: (_id: string | ObjectId, value: TUnitChecklistApprove | TUnitChecklistReject, session?: ClientSession) => Promise<number>;
299
+ createUniqueIndex: () => Promise<void>;
300
+ createSupply: (value: TSupplyCreate, session?: ClientSession) => Promise<ObjectId>;
301
+ getSupplies: ({ page, limit, search, site, }: TGetSupplysQuery) => Promise<{}>;
302
+ updateSupply: (_id: string | ObjectId, value: TSupplyUpdate, session?: ClientSession) => Promise<number>;
303
+ deleteSupply: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
495
304
  };
496
305
 
497
- declare function useUnitChecklistController(): {
498
- createUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
499
- getAllUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
500
- approveUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
501
- rejectUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
306
+ declare function useSupplyController(): {
307
+ createSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
308
+ getSupplies: (req: Request, res: Response, next: NextFunction) => Promise<void>;
309
+ updateSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
310
+ deleteSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
502
311
  };
503
312
 
504
- export { MArea, MAreaChecklist, MParentChecklist, MScheduleTaskArea, MToiletLocation, MUnit, MUnitChecklist, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistMetadata, TAreaUpdate, TAreaUpdateChecklist, TGetScheduleTaskAreasQuery, TGetToiletLocationsQuery, TGetUnitsQuery, TManageAreaChecklist, TParentChecklist, TParentChecklistStatus, TScheduleTaskArea, TScheduleTaskAreaCheckList, TToiletLocation, TToiletLocationChecklist, TToiletUpdateChecklist, TUnit, TUnitChecklist, TUnitChecklistApprove, TUnitChecklistMetadata, TUnitChecklistMetadataWorkOrder, TUnitChecklistReject, TUnitUpdate, allowedStatus, allowedTypes, areaChecklistSchema, areaSchema, parentChecklistSchema, scheduleTaskAreaSchema, toiletLocationSchema, unitChecklistSchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaController, useAreaRepository, useAreaService, useParentChecklistController, useParentChecklistRepo, useScheduleTaskAreaController, useScheduleTaskAreaRepository, useScheduleTaskAreaService, useToiletLocationController, useToiletLocationRepository, useToiletLocationService, useUnitChecklistController, useUnitChecklistRepo, useUnitController, useUnitRepository, useUnitService };
313
+ export { MArea, MAreaChecklist, MParentChecklist, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaCreate, TAreaGetAreasForChecklist, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TGetSupplysQuery, TGetUnitsQuery, TParentChecklist, TSupply, TSupplyCreate, TSupplyUpdate, TUnit, TUnitCreate, TUnitUpdate, allowedChecklistStatus, allowedStatus, allowedTypes, areaChecklistSchema, areaSchema, parentChecklistSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaRepo, useAreaService, useParentChecklistController, useParentChecklistRepo, useSupplyController, useSupplyRepository, useUnitController, useUnitRepository, useUnitService };