@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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +162 -353
- package/dist/index.js +1610 -3107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1630 -3151
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
status?:
|
|
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
|
|
23
|
-
|
|
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:
|
|
38
|
+
declare function MArea(value: TAreaCreate): {
|
|
39
|
+
site: string | ObjectId;
|
|
26
40
|
name: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
type: string;
|
|
42
|
+
set: number;
|
|
43
|
+
units: TAreaUnits[];
|
|
30
44
|
status: string;
|
|
31
45
|
createdAt: Date;
|
|
32
|
-
updatedAt: string
|
|
33
|
-
deletedAt: string
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
deletedAt: string;
|
|
34
48
|
};
|
|
35
49
|
|
|
36
|
-
declare function
|
|
50
|
+
declare function useAreaRepo(): {
|
|
37
51
|
createIndex: () => Promise<void>;
|
|
38
52
|
createTextIndex: () => Promise<void>;
|
|
39
53
|
createUniqueIndex: () => Promise<void>;
|
|
40
|
-
createArea: (value:
|
|
41
|
-
getAreas: ({ page, limit, search,
|
|
42
|
-
|
|
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
|
-
|
|
51
|
-
updateArea: (_id: string | ObjectId, value: TAreaUpdate) => Promise<number>;
|
|
52
|
-
updateAreaChecklist: (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
+
importArea: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
|
83
89
|
};
|
|
84
90
|
|
|
85
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
type
|
|
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
|
-
|
|
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:
|
|
227
|
-
name: string;
|
|
228
|
-
createdBy: string | ObjectId | undefined;
|
|
108
|
+
declare function MUnit(value: TUnitCreate): {
|
|
229
109
|
site: string | ObjectId | undefined;
|
|
230
|
-
|
|
110
|
+
name: string | undefined;
|
|
231
111
|
createdAt: Date;
|
|
232
|
-
|
|
233
|
-
|
|
112
|
+
status: string;
|
|
113
|
+
updatedAt: string;
|
|
114
|
+
deletedAt: string;
|
|
234
115
|
};
|
|
235
116
|
|
|
236
117
|
declare function useUnitService(): {
|
|
237
|
-
|
|
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:
|
|
251
|
-
getUnits: ({ page, limit, search,
|
|
252
|
-
|
|
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
|
-
|
|
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
|
-
|
|
143
|
+
importUnit: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
|
264
144
|
};
|
|
265
145
|
|
|
266
|
-
|
|
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
|
-
|
|
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
|
|
291
|
-
declare function
|
|
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
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
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
|
|
322
|
-
|
|
323
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
359
|
-
|
|
192
|
+
type TAreaChecklist = {
|
|
193
|
+
set: number;
|
|
194
|
+
units: TAreaChecklistUnits[];
|
|
360
195
|
};
|
|
361
|
-
type
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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
|
-
|
|
368
|
-
declare function MAreaChecklist(value: TAreaChecklist): {
|
|
369
|
-
type: string;
|
|
204
|
+
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule"> & {
|
|
370
205
|
site: string | ObjectId;
|
|
371
|
-
|
|
372
|
-
|
|
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
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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:
|
|
389
|
-
getAllAreaChecklist: ({ page, limit, search,
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
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
|
-
|
|
402
|
-
|
|
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
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
-
|
|
421
|
-
|
|
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
|
|
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
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
declare const
|
|
466
|
-
declare function
|
|
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
|
-
|
|
474
|
-
|
|
475
|
-
createdBy: string | ObjectId;
|
|
288
|
+
unitOfMeasurement: string;
|
|
289
|
+
qty: number;
|
|
476
290
|
createdAt: Date;
|
|
477
|
-
|
|
291
|
+
status: string;
|
|
292
|
+
updatedAt: string;
|
|
293
|
+
deletedAt: string;
|
|
478
294
|
};
|
|
479
295
|
|
|
480
|
-
declare function
|
|
296
|
+
declare function useSupplyRepository(): {
|
|
481
297
|
createIndex: () => Promise<void>;
|
|
482
298
|
createTextIndex: () => Promise<void>;
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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,
|
|
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 };
|