@iservice365/module-hygiene 0.2.0 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/module-hygiene
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 05f4523: Initial release
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -55,8 +55,9 @@ declare function useAreaRepo(): {
55
55
  getAreas: ({ page, limit, search, site, }: TAreaGetQuery) => Promise<{}>;
56
56
  getAreasForChecklist: ({ site, type, }: TAreaGetAreasForChecklist) => Promise<{}>;
57
57
  getAreaById: (_id: string | ObjectId) => Promise<{}>;
58
- updateArea: (_id: string | ObjectId, value: TAreaUpdate) => Promise<number>;
59
- 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>;
60
61
  deleteArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
61
62
  };
62
63
 
@@ -83,7 +84,6 @@ declare function useAreaController(): {
83
84
  getAreas: (req: Request, res: Response, next: NextFunction) => Promise<void>;
84
85
  getAreaById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
85
86
  updateArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
86
- updateAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
87
87
  deleteArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
88
88
  importArea: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
89
89
  };
@@ -98,7 +98,7 @@ type TUnit = {
98
98
  status?: "active" | "deleted";
99
99
  };
100
100
  type TUnitCreate = Partial<Pick<TUnit, "site" | "name">>;
101
- type TUnitUpdate = Partial<Pick<TUnit, "name">>;
101
+ type TUnitUpdate = Pick<TUnit, "name">;
102
102
  type TGetUnitsQuery = {
103
103
  page?: number;
104
104
  limit?: number;
@@ -121,6 +121,8 @@ declare function useUnitService(): {
121
121
  }) => Promise<{
122
122
  message: string;
123
123
  }>;
124
+ updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
125
+ deleteUnit: (_id: string | ObjectId) => Promise<number>;
124
126
  };
125
127
 
126
128
  declare function useUnitRepository(): {
@@ -129,7 +131,7 @@ declare function useUnitRepository(): {
129
131
  createUniqueIndex: () => Promise<void>;
130
132
  createUnit: (value: TUnitCreate, session?: ClientSession) => Promise<ObjectId>;
131
133
  getUnits: ({ page, limit, search, site, }: TGetUnitsQuery) => Promise<{}>;
132
- updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
134
+ updateUnit: (_id: string | ObjectId, value: TUnitUpdate, session?: ClientSession) => Promise<number>;
133
135
  deleteUnit: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
134
136
  };
135
137
 
@@ -167,7 +169,7 @@ declare function useParentChecklistRepo(): {
167
169
  startDate?: string | Date | undefined;
168
170
  endDate?: string | Date | undefined;
169
171
  }) => Promise<{}>;
170
- updateParentChecklistStatuses: (createdAt?: Date) => Promise<mongodb.BulkWriteResult | null>;
172
+ updateParentChecklistStatuses: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
171
173
  };
172
174
 
173
175
  declare function useParentChecklistController(): {
@@ -184,6 +186,7 @@ type TCleaningScheduleArea = {
184
186
  checklist: TAreaChecklist[];
185
187
  status?: (typeof allowedStatus)[number];
186
188
  createdAt?: Date | string;
189
+ completedAt?: Date | string;
187
190
  updatedAt?: Date | string;
188
191
  };
189
192
  type TAreaChecklist = {
@@ -191,14 +194,17 @@ type TAreaChecklist = {
191
194
  units: TAreaChecklistUnits[];
192
195
  };
193
196
  type TAreaChecklistUnits = {
197
+ unit: string | ObjectId;
194
198
  name: string;
195
199
  status?: (typeof allowedChecklistStatus)[number];
196
200
  remarks?: string;
201
+ completedBy?: string | ObjectId;
197
202
  timestamp?: Date | string;
198
203
  };
199
204
  type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule"> & {
200
205
  site: string | ObjectId;
201
206
  };
207
+ type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "remarks" | "completedBy">;
202
208
  declare const areaChecklistSchema: Joi.ObjectSchema<any>;
203
209
  declare function MAreaChecklist(value: TCleaningScheduleArea): {
204
210
  schedule: string | ObjectId;
@@ -207,9 +213,15 @@ declare function MAreaChecklist(value: TCleaningScheduleArea): {
207
213
  checklist: TAreaChecklist[];
208
214
  status: string;
209
215
  createdAt: Date;
216
+ completedAt: string;
210
217
  updatedAt: string;
211
218
  };
212
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>;
223
+ };
224
+
213
225
  declare function useAreaChecklistRepo(): {
214
226
  createIndex: () => Promise<void>;
215
227
  createTextIndex: () => Promise<void>;
@@ -220,23 +232,26 @@ declare function useAreaChecklistRepo(): {
220
232
  search?: string | undefined;
221
233
  type?: string | undefined;
222
234
  schedule: string | ObjectId;
223
- }) => Promise<{}>;
224
- getAreaChecklistHistory: ({ page, limit, search, site, type, schedule, status, createdAt, user, }: {
235
+ }, session?: ClientSession) => Promise<{}>;
236
+ getAreaChecklistHistory: ({ page, limit, search, type, schedule, status, createdAt, }: {
225
237
  page?: number | undefined;
226
238
  limit?: number | undefined;
227
239
  search?: string | undefined;
228
- site: string | ObjectId;
229
- type: (typeof allowedTypes)[number];
240
+ type?: string | undefined;
230
241
  schedule: string | ObjectId;
231
242
  status?: string | undefined;
232
243
  createdAt?: string | Date | undefined;
233
- user?: string | ObjectId | undefined;
234
244
  }) => Promise<{}>;
235
245
  getAreaChecklistHistoryDetails: (_id: string | ObjectId) => Promise<{}>;
236
- acceptAreaChecklist: (_id: string | ObjectId, acceptedBy: string | ObjectId) => Promise<number>;
237
- attachImageAreaChecklist: (_id: string | ObjectId, attachments: string[], session?: ClientSession) => Promise<number>;
238
- submitAreaChecklist: (_id: string | ObjectId, signature: string) => Promise<number>;
239
- 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>;
240
255
  };
241
256
 
242
257
  declare function useAreaChecklistController(): {
@@ -244,88 +259,55 @@ declare function useAreaChecklistController(): {
244
259
  getAllAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
245
260
  getAreaChecklistHistory: (req: Request, res: Response, next: NextFunction) => Promise<void>;
246
261
  getAreaChecklistHistoryDetails: (req: Request, res: Response, next: NextFunction) => Promise<void>;
247
- acceptAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
248
- attachImageAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
249
- submitAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
250
- 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>;
251
264
  };
252
265
 
253
- type TUnitChecklistMetadataWorkOrder = {
254
- attachments?: Array<string>;
255
- subject: string;
256
- category: string | ObjectId;
257
- highPriority?: boolean;
258
- block?: string;
259
- level?: string;
260
- unit?: string;
261
- location?: string;
262
- description: string;
263
- createdBy: string | ObjectId;
264
- createdByName?: string;
265
- serviceProvider?: string | ObjectId;
266
- organization?: string | ObjectId;
267
- site?: string | ObjectId;
268
- };
269
- type TUnitChecklistMetadata = {
270
- attachments?: string[];
271
- remarks?: string;
272
- workOrder?: TUnitChecklistMetadataWorkOrder;
273
- };
274
- type TUnitChecklist = {
266
+ type TSupply = {
275
267
  _id?: ObjectId;
276
268
  site: string | ObjectId;
277
- type: (typeof allowedTypes)[number];
278
- parentChecklist: string | ObjectId;
279
- areaChecklist: string | ObjectId;
280
- unit: ObjectId;
281
- name?: string;
282
- approve?: boolean;
283
- reject?: boolean;
284
- checkedBy?: string | ObjectId;
285
- metadata?: TUnitChecklistMetadata;
286
- createdBy?: string | ObjectId;
287
- createdAt?: Date | string;
288
- updatedAt?: Date | string;
269
+ name: string;
270
+ unitOfMeasurement: string;
271
+ qty: number;
272
+ createdAt?: string;
273
+ updatedAt?: string;
274
+ deletedAt?: string;
275
+ status?: "active" | "deleted";
289
276
  };
290
- type TUnitChecklistApprove = Partial<Pick<TUnitChecklist, "approve" | "reject" | "checkedBy">>;
291
- type TUnitChecklistReject = Partial<Pick<TUnitChecklist, "approve" | "reject" | "checkedBy" | "metadata">>;
292
- declare const unitChecklistSchema: Joi.ObjectSchema<any>;
293
- declare function MUnitChecklist(value: TUnitChecklist): {
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): {
294
286
  site: string | ObjectId;
295
- type: string;
296
- parentChecklist: string | ObjectId;
297
- areaChecklist: string | ObjectId;
298
- unit: ObjectId;
299
287
  name: string;
300
- approve: boolean;
301
- reject: boolean;
302
- createdBy: string | ObjectId;
288
+ unitOfMeasurement: string;
289
+ qty: number;
303
290
  createdAt: Date;
304
- updatedAt: string | Date;
291
+ status: string;
292
+ updatedAt: string;
293
+ deletedAt: string;
305
294
  };
306
295
 
307
- declare function useUnitChecklistRepo(): {
296
+ declare function useSupplyRepository(): {
308
297
  createIndex: () => Promise<void>;
309
298
  createTextIndex: () => Promise<void>;
310
- createUnitChecklist: (value: TUnitChecklist, session?: ClientSession) => Promise<ObjectId>;
311
- getAllUnitChecklist: ({ page, limit, search, site, type, parentChecklist, areaChecklist, }: {
312
- page?: number | undefined;
313
- limit?: number | undefined;
314
- search?: string | undefined;
315
- site: string | ObjectId;
316
- type: (typeof allowedTypes)[number];
317
- parentChecklist: string | ObjectId;
318
- areaChecklist: string | ObjectId;
319
- }) => Promise<{}>;
320
- getUnitChecklistById: (_id: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
321
- 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>;
322
304
  };
323
305
 
324
- declare function useUnitChecklistController(): {
325
- createUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
326
- getAllUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
327
- approveUnitChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
328
- 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>;
329
311
  };
330
312
 
331
- export { MArea, MAreaChecklist, MParentChecklist, MUnit, MUnitChecklist, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaCreate, TAreaGetAreasForChecklist, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TGetUnitsQuery, TParentChecklist, TUnit, TUnitChecklist, TUnitChecklistApprove, TUnitChecklistMetadata, TUnitChecklistMetadataWorkOrder, TUnitChecklistReject, TUnitCreate, TUnitUpdate, allowedChecklistStatus, areaChecklistSchema, areaSchema, parentChecklistSchema, unitChecklistSchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaController, useAreaRepo, useAreaService, useParentChecklistController, useParentChecklistRepo, 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 };