@iservice365/module-hygiene 0.0.1 → 0.1.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
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7fe7aae: Cleaning check list - initial implementation
8
+
3
9
  ## 0.0.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,2 +1,332 @@
1
+ import Joi from 'joi';
2
+ import * as mongodb from 'mongodb';
3
+ import { ObjectId, ClientSession } from 'mongodb';
4
+ import * as bson from 'bson';
5
+ import { Request, Response, NextFunction } from 'express';
1
6
 
2
- export { }
7
+ interface TAreaChecklist {
8
+ _id: string | ObjectId;
9
+ name: string;
10
+ }
11
+ type TArea = {
12
+ _id?: ObjectId;
13
+ name: string;
14
+ site?: string | ObjectId;
15
+ createdBy?: string | ObjectId;
16
+ checklist?: TAreaChecklist[];
17
+ status?: string;
18
+ createdAt?: Date | string;
19
+ updatedAt?: Date | string;
20
+ deletedAt?: Date | string;
21
+ };
22
+ type TAreaUpdate = Pick<TArea, "name">;
23
+ type TAreaUpdateChecklist = NonNullable<Pick<TArea, "checklist">>;
24
+ declare const areaSchema: Joi.ObjectSchema<any>;
25
+ declare function MArea(value: TArea): {
26
+ name: string;
27
+ site: string | ObjectId | undefined;
28
+ createdBy: string | ObjectId | undefined;
29
+ checklist: TAreaChecklist[] | undefined;
30
+ status: string;
31
+ createdAt: Date;
32
+ updatedAt: string | Date;
33
+ deletedAt: string | Date;
34
+ };
35
+
36
+ declare function useAreaRepository(): {
37
+ createIndex: () => Promise<void>;
38
+ createTextIndex: () => Promise<void>;
39
+ 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<{}>;
49
+ 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>;
53
+ deleteArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
54
+ };
55
+
56
+ declare function useAreaService(): {
57
+ uploadByFile: ({ dataJson, createdBy, site, }: {
58
+ dataJson: string;
59
+ createdBy: string | ObjectId;
60
+ site: string | ObjectId;
61
+ }) => Promise<{
62
+ message: string;
63
+ }>;
64
+ };
65
+
66
+ interface MulterRequest extends Request {
67
+ file?: {
68
+ buffer: Buffer;
69
+ originalname: string;
70
+ mimetype: string;
71
+ size: number;
72
+ };
73
+ }
74
+
75
+ declare function useAreaController(): {
76
+ createArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
77
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
78
+ getAreaById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
79
+ updateArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
80
+ updateAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
81
+ deleteArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
82
+ uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
83
+ };
84
+
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 = {
99
+ _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
+ interface TParentChecklistStatus {
163
+ site: string | ObjectId;
164
+ status: string;
165
+ completedAt: string | Date;
166
+ type: string;
167
+ }
168
+ type TParentChecklist = {
169
+ _id?: ObjectId;
170
+ date: Date;
171
+ status?: TParentChecklistStatus[];
172
+ createdAt?: Date | string;
173
+ updatedAt?: Date | string;
174
+ deletedAt?: Date | string;
175
+ };
176
+ declare const parentChecklistSchema: Joi.ObjectSchema<any>;
177
+ declare function MParentChecklist(value: TParentChecklist): {
178
+ date: Date;
179
+ status: TParentChecklistStatus[] | undefined;
180
+ createdAt: Date;
181
+ updatedAt: string | Date;
182
+ deletedAt: string | Date;
183
+ };
184
+
185
+ declare function useParentChecklistRepo(): {
186
+ createIndexes: () => Promise<void>;
187
+ create: (value: TParentChecklist, session?: ClientSession) => Promise<ObjectId | mongodb.WithId<bson.Document>>;
188
+ get: ({ page, limit, search, sort, startDate, endDate, }: {
189
+ page?: number | undefined;
190
+ limit?: number | undefined;
191
+ search?: string | undefined;
192
+ sort?: Record<string, any> | undefined;
193
+ startDate?: string | Date | undefined;
194
+ endDate?: string | Date | undefined;
195
+ site?: string | ObjectId | undefined;
196
+ }) => Promise<{}>;
197
+ };
198
+
199
+ declare function useParentCheckilstController(): {
200
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
201
+ create: (req: Request, res: Response, next: NextFunction) => Promise<void>;
202
+ };
203
+
204
+ interface TUnit {
205
+ _id?: ObjectId;
206
+ name: string;
207
+ site?: string | ObjectId;
208
+ createdBy?: string | ObjectId;
209
+ status?: string;
210
+ createdAt?: string | Date;
211
+ updatedAt?: string | Date;
212
+ deletedAt?: string | Date;
213
+ }
214
+ type TUnitUpdate = Partial<Pick<TUnit, "name">>;
215
+ interface TGetUnitsQuery {
216
+ page?: number;
217
+ limit?: number;
218
+ search?: string;
219
+ startDate?: Date | string;
220
+ endDate?: Date | string;
221
+ site: ObjectId | string;
222
+ }
223
+ declare const unitSchema: Joi.ObjectSchema<any>;
224
+ declare function MUnit(value: TUnit): {
225
+ name: string;
226
+ createdBy: string | ObjectId | undefined;
227
+ site: string | ObjectId | undefined;
228
+ status: string;
229
+ createdAt: Date;
230
+ updatedAt: string | Date;
231
+ deletedAt: string | Date;
232
+ };
233
+
234
+ declare function useUnitService(): {
235
+ uploadByFile: ({ dataJson, createdBy, site, }: {
236
+ dataJson: string;
237
+ createdBy: string | ObjectId;
238
+ site: string | ObjectId;
239
+ }) => Promise<{
240
+ message: string;
241
+ }>;
242
+ };
243
+
244
+ declare function useUnitRepository(): {
245
+ createIndex: () => Promise<void>;
246
+ createTextIndex: () => Promise<void>;
247
+ createUniqueIndex: () => Promise<void>;
248
+ createUnit: (value: TUnit, session?: ClientSession) => Promise<ObjectId>;
249
+ getUnits: ({ page, limit, search, startDate, endDate, site, }: TGetUnitsQuery) => Promise<{}>;
250
+ getUnitByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
251
+ getUnitById: (id: string | ObjectId, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
252
+ updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
253
+ deleteUnit: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
254
+ };
255
+
256
+ declare function useUnitController(): {
257
+ createUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
258
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
259
+ updateUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
260
+ deleteUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
261
+ uploadByFile: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
262
+ };
263
+
264
+ interface TScheduleTaskAreaCheckList {
265
+ _id: string | ObjectId;
266
+ name: string;
267
+ }
268
+ interface TGetScheduleTaskAreasQuery {
269
+ page?: number;
270
+ limit?: number;
271
+ search?: string;
272
+ sort?: Record<string, any>;
273
+ startDate?: Date | string;
274
+ endDate?: Date | string;
275
+ site: ObjectId | string;
276
+ }
277
+ type TScheduleTaskArea = {
278
+ _id?: ObjectId;
279
+ name: string;
280
+ site?: string | ObjectId;
281
+ createdBy?: string | ObjectId;
282
+ checklist?: TScheduleTaskAreaCheckList[];
283
+ status?: string;
284
+ createdAt?: Date | string;
285
+ updatedAt?: Date | string;
286
+ deletedAt?: Date | string;
287
+ };
288
+ declare const scheduleTaskAreaSchema: Joi.ObjectSchema<any>;
289
+ declare function MScheduleTaskArea(value: TScheduleTaskArea): {
290
+ name: string;
291
+ site: string | ObjectId | undefined;
292
+ createdBy: string | ObjectId | undefined;
293
+ checklist: TScheduleTaskAreaCheckList[] | undefined;
294
+ status: string;
295
+ createdAt: Date;
296
+ updatedAt: string | Date;
297
+ deletedAt: string | Date;
298
+ };
299
+
300
+ declare function useScheduleTaskAreaRepository(): {
301
+ createScheduleTaskArea: (value: TScheduleTaskArea, session?: ClientSession) => Promise<ObjectId>;
302
+ updateScheduleTaskArea: (_id: string | ObjectId, params: TScheduleTaskArea) => Promise<number>;
303
+ deleteScheduleTaskArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
304
+ getScheduleTaskAreas: ({ page, limit, search, sort, startDate, endDate, site, }: {
305
+ page?: number | undefined;
306
+ limit?: number | undefined;
307
+ search?: string | undefined;
308
+ sort?: Record<string, any> | undefined;
309
+ startDate?: string | Date | undefined;
310
+ endDate?: string | Date | undefined;
311
+ site?: string | ObjectId | undefined;
312
+ }) => Promise<{}>;
313
+ createIndexes: () => Promise<void>;
314
+ getScheduleTaskAreaByName: (name: string, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
315
+ getScheduleTaskAreaById: (id: string | ObjectId, site?: string | ObjectId) => Promise<mongodb.WithId<bson.Document> | null>;
316
+ };
317
+
318
+ declare function useScheduleTaskAreaService(): {
319
+ getAll: (query: TGetScheduleTaskAreasQuery) => Promise<{}>;
320
+ create: (scheduleTaskArea: TScheduleTaskArea) => Promise<ObjectId>;
321
+ updateById: (id: string | ObjectId, scheduleTaskArea: TScheduleTaskArea) => Promise<number>;
322
+ deleteById: (id: string | ObjectId) => Promise<number>;
323
+ };
324
+
325
+ declare function useScheduleTaskAreaController(): {
326
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
327
+ createScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
328
+ updateScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
329
+ deleteScheduleTaskArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
330
+ };
331
+
332
+ export { MArea, MParentChecklist, MScheduleTaskArea, MToiletLocation, MUnit, TArea, TAreaChecklist, TAreaUpdate, TAreaUpdateChecklist, TGetScheduleTaskAreasQuery, TGetToiletLocationsQuery, TGetUnitsQuery, TParentChecklist, TParentChecklistStatus, TScheduleTaskArea, TScheduleTaskAreaCheckList, TToiletLocation, TToiletLocationChecklist, TToiletUpdateChecklist, TUnit, TUnitUpdate, areaSchema, parentChecklistSchema, scheduleTaskAreaSchema, toiletLocationSchema, unitSchema, useAreaController, useAreaRepository, useAreaService, useParentCheckilstController, useParentChecklistRepo, useScheduleTaskAreaController, useScheduleTaskAreaRepository, useScheduleTaskAreaService, useToiletLocationController, useToiletLocationRepository, useToiletLocationService, useUnitController, useUnitRepository, useUnitService };