@7365admin1/module-hygiene 1.7.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/main.yml +17 -0
- package/.github/workflows/publish.yml +39 -0
- package/CHANGELOG.md +110 -0
- package/PUBLISHING.md +269 -0
- package/dist/index.d.ts +549 -0
- package/dist/index.js +5703 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5706 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
- package/tsconfig.json +108 -0
- package/tsup.config.ts +10 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import * as mongodb from 'mongodb';
|
|
2
|
+
import { ObjectId, ClientSession } from 'mongodb';
|
|
3
|
+
import { Request, Response, NextFunction } from 'express';
|
|
4
|
+
import Joi from 'joi';
|
|
5
|
+
import * as bson from 'bson';
|
|
6
|
+
|
|
7
|
+
declare const allowedTypes: string[];
|
|
8
|
+
declare const allowedStatus: string[];
|
|
9
|
+
declare const allowedPeriods: string[];
|
|
10
|
+
|
|
11
|
+
declare function useHygieneDashboardRepository(): {
|
|
12
|
+
getHygieneDashboard: ({ site, feedbackPeriod, commonAreaPeriod, toiletAreaPeriod, scheduleTaskPeriod, supplyPeriod, requestItemPeriod, }: {
|
|
13
|
+
site: string | ObjectId;
|
|
14
|
+
feedbackPeriod?: string | undefined;
|
|
15
|
+
commonAreaPeriod?: string | undefined;
|
|
16
|
+
toiletAreaPeriod?: string | undefined;
|
|
17
|
+
scheduleTaskPeriod?: string | undefined;
|
|
18
|
+
supplyPeriod?: string | undefined;
|
|
19
|
+
requestItemPeriod?: string | undefined;
|
|
20
|
+
}) => Promise<{}>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
declare function useHygieneDashboardController(): {
|
|
24
|
+
getHygieneDashboard: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type TAreaUnits = {
|
|
28
|
+
unit: string | ObjectId;
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
type TArea = {
|
|
32
|
+
_id?: ObjectId;
|
|
33
|
+
site: string | ObjectId;
|
|
34
|
+
name: string;
|
|
35
|
+
type: (typeof allowedTypes)[number];
|
|
36
|
+
set?: number;
|
|
37
|
+
units?: TAreaUnits[];
|
|
38
|
+
status?: "active" | "deleted";
|
|
39
|
+
createdAt?: Date | string;
|
|
40
|
+
updatedAt?: Date | string;
|
|
41
|
+
deletedAt?: Date | string;
|
|
42
|
+
};
|
|
43
|
+
type TAreaCreate = Pick<TArea, "site" | "name" | "type" | "set" | "units">;
|
|
44
|
+
type TAreaGetQuery = {
|
|
45
|
+
page?: number;
|
|
46
|
+
limit?: number;
|
|
47
|
+
search?: string;
|
|
48
|
+
type?: (typeof allowedTypes)[number] | "all";
|
|
49
|
+
} & Pick<TArea, "site">;
|
|
50
|
+
type TAreaUpdate = Partial<Pick<TArea, "name" | "type" | "set" | "units">>;
|
|
51
|
+
type TAreaUpdateChecklist = {
|
|
52
|
+
units: TAreaUnits[];
|
|
53
|
+
};
|
|
54
|
+
declare const areaSchema: Joi.ObjectSchema<any>;
|
|
55
|
+
declare function MArea(value: TAreaCreate): {
|
|
56
|
+
site: string | ObjectId;
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
set: number;
|
|
60
|
+
units: TAreaUnits[];
|
|
61
|
+
status: string;
|
|
62
|
+
createdAt: Date;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
deletedAt: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare function useAreaRepo(): {
|
|
68
|
+
createIndex: () => Promise<void>;
|
|
69
|
+
createTextIndex: () => Promise<void>;
|
|
70
|
+
createUniqueIndex: () => Promise<void>;
|
|
71
|
+
createArea: (value: TAreaCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
72
|
+
getAreas: ({ page, limit, search, type, site, }: TAreaGetQuery) => Promise<{}>;
|
|
73
|
+
getAreasForChecklist: (site: string | ObjectId) => Promise<{}>;
|
|
74
|
+
getAreaById: (_id: string | ObjectId) => Promise<{}>;
|
|
75
|
+
getAreaByMultipleId: (_id: string[] | ObjectId[]) => Promise<bson.Document[]>;
|
|
76
|
+
verifyAreaByUnitId: (unitId: string | ObjectId) => Promise<{}>;
|
|
77
|
+
updateArea: (_id: string | ObjectId, value: TAreaUpdate, session?: ClientSession) => Promise<number>;
|
|
78
|
+
updateAreaChecklist: (unitId: string | ObjectId, name: string, session?: ClientSession) => Promise<number>;
|
|
79
|
+
deleteArea: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
declare function useAreaService(): {
|
|
83
|
+
importArea: ({ dataJson, site, }: {
|
|
84
|
+
dataJson: string;
|
|
85
|
+
site: string | ObjectId;
|
|
86
|
+
}) => Promise<{
|
|
87
|
+
message: string;
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
interface MulterRequest extends Request {
|
|
92
|
+
file?: {
|
|
93
|
+
buffer: Buffer;
|
|
94
|
+
originalname: string;
|
|
95
|
+
mimetype: string;
|
|
96
|
+
size: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare function useAreaController(): {
|
|
101
|
+
createArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
102
|
+
getAreas: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
103
|
+
getAreaById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
104
|
+
updateArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
105
|
+
deleteArea: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
106
|
+
importArea: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type TUnit = {
|
|
110
|
+
_id?: ObjectId;
|
|
111
|
+
site: string | ObjectId;
|
|
112
|
+
name: string;
|
|
113
|
+
createdAt?: string;
|
|
114
|
+
updatedAt?: string;
|
|
115
|
+
deletedAt?: string;
|
|
116
|
+
status?: "active" | "deleted";
|
|
117
|
+
};
|
|
118
|
+
type TUnitCreate = Pick<TUnit, "site" | "name">;
|
|
119
|
+
type TUnitGetQuery = {
|
|
120
|
+
page?: number;
|
|
121
|
+
limit?: number;
|
|
122
|
+
search?: string;
|
|
123
|
+
} & Pick<TUnit, "site">;
|
|
124
|
+
type TUnitUpdate = Pick<TUnit, "name">;
|
|
125
|
+
declare const unitSchema: Joi.ObjectSchema<any>;
|
|
126
|
+
declare function MUnit(value: TUnitCreate): {
|
|
127
|
+
site: string | ObjectId;
|
|
128
|
+
name: string;
|
|
129
|
+
status: string;
|
|
130
|
+
createdAt: Date;
|
|
131
|
+
updatedAt: string;
|
|
132
|
+
deletedAt: string;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
declare function useUnitService(): {
|
|
136
|
+
importUnit: ({ dataJson, site, }: {
|
|
137
|
+
dataJson: string;
|
|
138
|
+
site: string | ObjectId;
|
|
139
|
+
}) => Promise<{
|
|
140
|
+
message: string;
|
|
141
|
+
}>;
|
|
142
|
+
updateUnit: (_id: string | ObjectId, value: TUnitUpdate) => Promise<number>;
|
|
143
|
+
deleteUnit: (_id: string | ObjectId) => Promise<number>;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare function useUnitRepository(): {
|
|
147
|
+
createIndex: () => Promise<void>;
|
|
148
|
+
createTextIndex: () => Promise<void>;
|
|
149
|
+
createUniqueIndex: () => Promise<void>;
|
|
150
|
+
createUnit: (value: TUnitCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
151
|
+
getUnits: ({ page, limit, search, site, }: TUnitGetQuery) => Promise<{}>;
|
|
152
|
+
updateUnit: (_id: string | ObjectId, value: TUnitUpdate, session?: ClientSession) => Promise<number>;
|
|
153
|
+
deleteUnit: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
declare function useUnitController(): {
|
|
157
|
+
createUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
158
|
+
getUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
159
|
+
updateUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
160
|
+
deleteUnit: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
161
|
+
importUnit: (req: MulterRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
type TParentChecklist = {
|
|
165
|
+
_id?: ObjectId;
|
|
166
|
+
site?: string | ObjectId;
|
|
167
|
+
status?: (typeof allowedStatus)[number];
|
|
168
|
+
createdAt?: Date | string;
|
|
169
|
+
updatedAt?: Date | string;
|
|
170
|
+
};
|
|
171
|
+
type TParentChecklistGetQuery = {
|
|
172
|
+
page?: number;
|
|
173
|
+
limit?: number;
|
|
174
|
+
search?: string;
|
|
175
|
+
site: string | ObjectId;
|
|
176
|
+
startDate?: string | Date;
|
|
177
|
+
endDate?: string | Date;
|
|
178
|
+
} & Pick<TParentChecklist, "status">;
|
|
179
|
+
declare const parentChecklistSchema: Joi.ObjectSchema<any>;
|
|
180
|
+
declare function MParentChecklist(value: TParentChecklist): {
|
|
181
|
+
site: string | ObjectId | undefined;
|
|
182
|
+
status: string;
|
|
183
|
+
createdAt: string | Date;
|
|
184
|
+
updatedAt: string | Date;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
declare function useParentChecklistRepo(): {
|
|
188
|
+
createIndex: () => Promise<void>;
|
|
189
|
+
createParentChecklist: (value: TParentChecklist, session?: ClientSession) => Promise<ObjectId | ObjectId[]>;
|
|
190
|
+
getAllParentChecklist: ({ page, limit, search, site, startDate, endDate, status, }: TParentChecklistGetQuery) => Promise<{}>;
|
|
191
|
+
updateParentChecklistStatuses: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
declare function useParentChecklistController(): {
|
|
195
|
+
createParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
196
|
+
getAllParentChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
declare const allowedChecklistStatus: string[];
|
|
200
|
+
type TCleaningScheduleArea = {
|
|
201
|
+
_id?: ObjectId;
|
|
202
|
+
schedule: string | ObjectId;
|
|
203
|
+
area: string | ObjectId;
|
|
204
|
+
name: string;
|
|
205
|
+
type: (typeof allowedTypes)[number];
|
|
206
|
+
checklist: TAreaChecklist[];
|
|
207
|
+
status?: (typeof allowedStatus)[number];
|
|
208
|
+
createdAt?: Date | string;
|
|
209
|
+
completedAt?: Date | string;
|
|
210
|
+
updatedAt?: Date | string;
|
|
211
|
+
};
|
|
212
|
+
type TAreaChecklist = {
|
|
213
|
+
set: number;
|
|
214
|
+
units: TAreaChecklistUnits[];
|
|
215
|
+
};
|
|
216
|
+
type TAreaChecklistUnits = {
|
|
217
|
+
unit: string | ObjectId;
|
|
218
|
+
name: string;
|
|
219
|
+
status?: (typeof allowedChecklistStatus)[number];
|
|
220
|
+
remarks?: string;
|
|
221
|
+
completedBy?: string | ObjectId;
|
|
222
|
+
timestamp?: Date | string;
|
|
223
|
+
};
|
|
224
|
+
type TAreaChecklistCreate = Pick<TCleaningScheduleArea, "schedule" | "area"> & {
|
|
225
|
+
site: string | ObjectId;
|
|
226
|
+
};
|
|
227
|
+
type TAreaChecklistBatchCreate = Pick<TCleaningScheduleArea, "schedule"> & {
|
|
228
|
+
site: string | ObjectId;
|
|
229
|
+
};
|
|
230
|
+
type TCleaningScheduleAreaGetQuery = {
|
|
231
|
+
page?: number;
|
|
232
|
+
limit?: number;
|
|
233
|
+
search?: string;
|
|
234
|
+
type?: (typeof allowedTypes)[number] | "all";
|
|
235
|
+
status?: (typeof allowedStatus)[number] | "all";
|
|
236
|
+
} & Pick<TCleaningScheduleArea, "schedule">;
|
|
237
|
+
type TAreaChecklistUpdate = Pick<TCleaningScheduleArea, "checklist">;
|
|
238
|
+
type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "remarks" | "completedBy">;
|
|
239
|
+
declare const areaChecklistSchema: Joi.ObjectSchema<any>;
|
|
240
|
+
declare function MAreaChecklist(value: TCleaningScheduleArea): {
|
|
241
|
+
schedule: string | ObjectId;
|
|
242
|
+
area: string | ObjectId;
|
|
243
|
+
name: string;
|
|
244
|
+
type: string;
|
|
245
|
+
checklist: TAreaChecklist[];
|
|
246
|
+
status: string;
|
|
247
|
+
createdAt: Date;
|
|
248
|
+
completedAt: string;
|
|
249
|
+
updatedAt: string;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
declare function useAreaChecklistService(): {
|
|
253
|
+
createAreaChecklist: (value: TAreaChecklistBatchCreate) => Promise<ObjectId[]>;
|
|
254
|
+
completeAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate) => Promise<void>;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
declare function useAreaChecklistRepo(): {
|
|
258
|
+
createIndex: () => Promise<void>;
|
|
259
|
+
createTextIndex: () => Promise<void>;
|
|
260
|
+
createAreaChecklist: (value: TCleaningScheduleArea, session?: ClientSession) => Promise<ObjectId>;
|
|
261
|
+
getAllAreaChecklist: ({ page, limit, search, type, status, schedule, }: TCleaningScheduleAreaGetQuery, session?: ClientSession) => Promise<{}>;
|
|
262
|
+
getAreaChecklistHistory: ({ page, limit, search, type, schedule, status, createdAt, }: {
|
|
263
|
+
page?: number | undefined;
|
|
264
|
+
limit?: number | undefined;
|
|
265
|
+
search?: string | undefined;
|
|
266
|
+
type?: string | undefined;
|
|
267
|
+
schedule: string | ObjectId;
|
|
268
|
+
status?: string | undefined;
|
|
269
|
+
createdAt?: string | Date | undefined;
|
|
270
|
+
}) => Promise<{}>;
|
|
271
|
+
getAreaChecklistHistoryDetails: (_id: string | ObjectId) => Promise<{}>;
|
|
272
|
+
getAreaChecklistUnits: ({ page, limit, search, _id, }: {
|
|
273
|
+
page?: number | undefined;
|
|
274
|
+
limit?: number | undefined;
|
|
275
|
+
search?: string | undefined;
|
|
276
|
+
_id: string | ObjectId;
|
|
277
|
+
}, session?: ClientSession) => Promise<{}>;
|
|
278
|
+
getAreaChecklistById: (_id: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
|
|
279
|
+
getAreaChecklistByAreaAndSchedule: (schedule: string | ObjectId, area: string | ObjectId, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
|
|
280
|
+
updateAreaChecklist: (_id: string | ObjectId, value: TAreaChecklistUpdate, session?: ClientSession) => Promise<number>;
|
|
281
|
+
updateAreaChecklistStatus: (_id: string | ObjectId, status: (typeof allowedStatus)[number], session?: ClientSession) => Promise<number>;
|
|
282
|
+
completeAreaChecklistUnits: (_id: string | ObjectId, set: number, unitId: string | ObjectId, value: TAreaChecklistUnitsUpdate, session?: ClientSession) => Promise<number>;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
declare function useAreaChecklistController(): {
|
|
286
|
+
createAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
287
|
+
getAllAreaChecklist: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
288
|
+
getAreaChecklistHistory: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
289
|
+
getAreaChecklistHistoryDetails: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
290
|
+
getAreaChecklistUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
291
|
+
completeAreaChecklistUnits: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
type TSupply = {
|
|
295
|
+
_id?: ObjectId;
|
|
296
|
+
site: string | ObjectId;
|
|
297
|
+
name: string;
|
|
298
|
+
unitOfMeasurement: string;
|
|
299
|
+
qty: number;
|
|
300
|
+
status?: "active" | "deleted";
|
|
301
|
+
createdAt?: string;
|
|
302
|
+
updatedAt?: string;
|
|
303
|
+
deletedAt?: string;
|
|
304
|
+
};
|
|
305
|
+
type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement">;
|
|
306
|
+
type TSupplyGetQuery = {
|
|
307
|
+
page?: number;
|
|
308
|
+
limit?: number;
|
|
309
|
+
search?: string;
|
|
310
|
+
} & Pick<TSupply, "site">;
|
|
311
|
+
type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty">;
|
|
312
|
+
type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
|
|
313
|
+
declare const supplySchema: Joi.ObjectSchema<any>;
|
|
314
|
+
declare function MSupply(value: TSupplyCreate): {
|
|
315
|
+
site: string | ObjectId;
|
|
316
|
+
name: string;
|
|
317
|
+
unitOfMeasurement: string;
|
|
318
|
+
qty: number;
|
|
319
|
+
status: string;
|
|
320
|
+
createdAt: string;
|
|
321
|
+
updatedAt: string;
|
|
322
|
+
deletedAt: string;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
declare function useSupplyRepository(): {
|
|
326
|
+
createIndex: () => Promise<void>;
|
|
327
|
+
createTextIndex: () => Promise<void>;
|
|
328
|
+
createUniqueIndex: () => Promise<void>;
|
|
329
|
+
createSupply: (value: TSupplyCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
330
|
+
getSupplies: ({ page, limit, search, site, }: TSupplyGetQuery) => Promise<{}>;
|
|
331
|
+
getSupplyById: (_id: string | ObjectId, session?: ClientSession) => Promise<TSupplyGetById>;
|
|
332
|
+
updateSupply: (_id: string | ObjectId, value: TSupplyUpdate, session?: ClientSession) => Promise<number>;
|
|
333
|
+
deleteSupply: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
declare function useSupplyController(): {
|
|
337
|
+
createSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
338
|
+
getSupplies: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
339
|
+
getSupplyById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
340
|
+
updateSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
341
|
+
deleteSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
type TStock = {
|
|
345
|
+
_id?: ObjectId;
|
|
346
|
+
site: string | ObjectId;
|
|
347
|
+
supply: string | ObjectId;
|
|
348
|
+
in?: number;
|
|
349
|
+
out?: number;
|
|
350
|
+
balance: number;
|
|
351
|
+
remarks?: string;
|
|
352
|
+
status?: "active" | "deleted";
|
|
353
|
+
createdAt?: string;
|
|
354
|
+
updatedAt?: string;
|
|
355
|
+
deletedAt?: string;
|
|
356
|
+
};
|
|
357
|
+
type TStockCreate = Pick<TStock, "site" | "supply" | "in" | "out" | "balance" | "remarks">;
|
|
358
|
+
type TStockCreateService = Pick<TStock, "site" | "supply" | "remarks"> & {
|
|
359
|
+
qty: number;
|
|
360
|
+
};
|
|
361
|
+
type TGetStocksQuery = {
|
|
362
|
+
page?: number;
|
|
363
|
+
limit?: number;
|
|
364
|
+
search?: string;
|
|
365
|
+
} & Pick<TStock, "site" | "supply">;
|
|
366
|
+
declare const stockSchema: Joi.ObjectSchema<any>;
|
|
367
|
+
declare function MStock(value: TStockCreate): {
|
|
368
|
+
site: string | ObjectId;
|
|
369
|
+
supply: string | ObjectId;
|
|
370
|
+
in: number;
|
|
371
|
+
out: number;
|
|
372
|
+
balance: number;
|
|
373
|
+
remarks: string;
|
|
374
|
+
createdAt: string;
|
|
375
|
+
status: string;
|
|
376
|
+
updatedAt: string;
|
|
377
|
+
deletedAt: string;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
declare function useStockRepository(): {
|
|
381
|
+
createIndex: () => Promise<void>;
|
|
382
|
+
createStock: (value: TStockCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
383
|
+
getStocksBySupplyId: ({ page, limit, search, site, supply, }: TGetStocksQuery) => Promise<{}>;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
declare function useStockService(): {
|
|
387
|
+
createStock: (value: TStockCreateService, out?: boolean) => Promise<bson.ObjectId>;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
declare function useStockController(): {
|
|
391
|
+
createStock: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
392
|
+
getStocksBySupplyId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
declare const allowedRequestItemStatus: string[];
|
|
396
|
+
type TRequestItem = {
|
|
397
|
+
_id?: ObjectId;
|
|
398
|
+
site: string | ObjectId;
|
|
399
|
+
supply: string | ObjectId;
|
|
400
|
+
supplyName: string;
|
|
401
|
+
qty: number;
|
|
402
|
+
remarks?: string;
|
|
403
|
+
createdBy: string | ObjectId;
|
|
404
|
+
createdByName: string;
|
|
405
|
+
status?: (typeof allowedRequestItemStatus)[number];
|
|
406
|
+
createdAt?: string;
|
|
407
|
+
updatedAt?: string;
|
|
408
|
+
deletedAt?: string;
|
|
409
|
+
};
|
|
410
|
+
type TRequestItemCreate = Pick<TRequestItem, "site" | "supply" | "supplyName" | "qty" | "createdBy" | "createdByName">;
|
|
411
|
+
type TRequestItemCreateService = Pick<TRequestItem, "site" | "supply" | "qty" | "createdBy">;
|
|
412
|
+
type TRequestItemCreateByBatchService = Pick<TRequestItem, "site" | "createdBy"> & {
|
|
413
|
+
items: Pick<TRequestItem, "supply" | "qty">[];
|
|
414
|
+
};
|
|
415
|
+
type TRequestItemGetQuery = {
|
|
416
|
+
page?: number;
|
|
417
|
+
limit?: number;
|
|
418
|
+
search?: string;
|
|
419
|
+
} & Pick<TRequestItem, "site">;
|
|
420
|
+
type TRequestItemGetById = Pick<TRequestItem, "_id" | "site" | "supply" | "supplyName" | "qty" | "status"> & {
|
|
421
|
+
unitOfMeasurement?: string;
|
|
422
|
+
};
|
|
423
|
+
declare const requestItemSchema: Joi.ObjectSchema<any>;
|
|
424
|
+
declare function MRequestItem(value: TRequestItemCreate): {
|
|
425
|
+
site: string | ObjectId;
|
|
426
|
+
supply: string | ObjectId;
|
|
427
|
+
supplyName: string;
|
|
428
|
+
qty: number;
|
|
429
|
+
remarks: string;
|
|
430
|
+
createdBy: string | ObjectId;
|
|
431
|
+
createdByName: string;
|
|
432
|
+
status: string;
|
|
433
|
+
createdAt: string;
|
|
434
|
+
updatedAt: string;
|
|
435
|
+
deletedAt: string;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
declare function useRequestItemRepository(): {
|
|
439
|
+
createIndex: () => Promise<void>;
|
|
440
|
+
createTextIndex: () => Promise<void>;
|
|
441
|
+
createRequestItem: (value: TRequestItemCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
442
|
+
getRequestItems: ({ page, limit, search, site, }: TRequestItemGetQuery) => Promise<{}>;
|
|
443
|
+
getRequestItemById: (_id: string | ObjectId, session?: ClientSession) => Promise<TRequestItemGetById>;
|
|
444
|
+
approveRequestItem: (_id: string | ObjectId, remarks?: string, session?: ClientSession) => Promise<number>;
|
|
445
|
+
disapproveRequestItem: (_id: string | ObjectId, remarks?: string, session?: ClientSession) => Promise<number>;
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
declare function useRequestItemService(): {
|
|
449
|
+
createRequestItem: (value: TRequestItemCreateService) => Promise<bson.ObjectId>;
|
|
450
|
+
createRequestItemByBatch: (value: TRequestItemCreateByBatchService) => Promise<bson.ObjectId[]>;
|
|
451
|
+
approveRequestItem: (id: string, remarks?: string) => Promise<bson.ObjectId>;
|
|
452
|
+
disapproveRequestItem: (id: string, remarks?: string) => Promise<number>;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
declare function useRequestItemController(): {
|
|
456
|
+
createRequestItem: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
457
|
+
createRequestItemByBatch: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
458
|
+
getRequestItems: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
459
|
+
getRequestItemById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
460
|
+
approveRequestItem: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
461
|
+
disapproveRequestItem: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
declare const allowedFrequency: string[];
|
|
465
|
+
declare const allowedDays: string[];
|
|
466
|
+
declare const allowedWeekOfMonth: string[];
|
|
467
|
+
declare const allowedMonths: string[];
|
|
468
|
+
type TScheduleTask = {
|
|
469
|
+
_id?: ObjectId;
|
|
470
|
+
site: string | ObjectId;
|
|
471
|
+
title: string;
|
|
472
|
+
frequency: (typeof allowedFrequency)[number];
|
|
473
|
+
time: string;
|
|
474
|
+
day?: (typeof allowedDays)[number][];
|
|
475
|
+
weekOfMonth?: (typeof allowedWeekOfMonth)[number];
|
|
476
|
+
month?: (typeof allowedMonths)[number];
|
|
477
|
+
date?: number;
|
|
478
|
+
description?: string;
|
|
479
|
+
areas: {
|
|
480
|
+
name: string;
|
|
481
|
+
value: Object;
|
|
482
|
+
}[];
|
|
483
|
+
status?: "active" | "deleted";
|
|
484
|
+
createdAt?: string | Date;
|
|
485
|
+
updatedAt?: string | Date;
|
|
486
|
+
deletedAt?: string | Date;
|
|
487
|
+
};
|
|
488
|
+
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas">;
|
|
489
|
+
type TScheduleTaskGetQuery = {
|
|
490
|
+
page?: number;
|
|
491
|
+
limit?: number;
|
|
492
|
+
search?: string;
|
|
493
|
+
} & Pick<TScheduleTask, "site">;
|
|
494
|
+
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas" | "status" | "createdAt">;
|
|
495
|
+
type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas">>;
|
|
496
|
+
declare const scheduleTaskSchema: Joi.ObjectSchema<any>;
|
|
497
|
+
declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
498
|
+
site: string | ObjectId;
|
|
499
|
+
title: string;
|
|
500
|
+
frequency: string;
|
|
501
|
+
time: string;
|
|
502
|
+
day: string[] | undefined;
|
|
503
|
+
weekOfMonth: string | undefined;
|
|
504
|
+
month: string | undefined;
|
|
505
|
+
date: number | undefined;
|
|
506
|
+
description: string | undefined;
|
|
507
|
+
areas: {
|
|
508
|
+
name: string;
|
|
509
|
+
value: Object;
|
|
510
|
+
}[];
|
|
511
|
+
status: string;
|
|
512
|
+
createdAt: Date;
|
|
513
|
+
updatedAt: string;
|
|
514
|
+
deletedAt: string;
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
declare function useScheduleTaskRepository(): {
|
|
518
|
+
createIndex: () => Promise<void>;
|
|
519
|
+
createTextIndex: () => Promise<void>;
|
|
520
|
+
createScheduleTask: (value: TScheduleTaskCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
521
|
+
getScheduleTasks: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
|
|
522
|
+
getAllScheduleTask: () => Promise<TScheduleTask[]>;
|
|
523
|
+
getTasksForScheduleTask: ({ page, limit, search, site, }: TScheduleTaskGetQuery) => Promise<{}>;
|
|
524
|
+
getScheduleTaskById: (_id: string | ObjectId, session?: ClientSession) => Promise<TScheduleTaskGetById>;
|
|
525
|
+
updateScheduleTask: (_id: string | ObjectId, value: TScheduleTaskUpdate, session?: ClientSession) => Promise<number>;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
declare function useScheduleTaskService(): {
|
|
529
|
+
checkScheduleConditions: (schedule: any, currentDate?: Date) => boolean;
|
|
530
|
+
processScheduledTasks: (currentDate?: Date) => Promise<{
|
|
531
|
+
processed: number;
|
|
532
|
+
validated: number;
|
|
533
|
+
tasks?: undefined;
|
|
534
|
+
} | {
|
|
535
|
+
processed: number;
|
|
536
|
+
validated: number;
|
|
537
|
+
tasks: TScheduleTask[];
|
|
538
|
+
}>;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
declare function useScheduleTaskController(): {
|
|
542
|
+
createScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
543
|
+
getScheduleTasks: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
544
|
+
getTasksForScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
545
|
+
getScheduleTaskById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
546
|
+
updateScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
export { MArea, MAreaChecklist, MParentChecklist, MRequestItem, MScheduleTask, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistBatchCreate, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaChecklistUpdate, TAreaCreate, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TCleaningScheduleAreaGetQuery, TGetStocksQuery, TParentChecklist, TParentChecklistGetQuery, TRequestItem, TRequestItemCreate, TRequestItemCreateByBatchService, TRequestItemCreateService, TRequestItemGetById, TRequestItemGetQuery, TScheduleTask, TScheduleTaskCreate, TScheduleTaskGetById, TScheduleTaskGetQuery, TScheduleTaskUpdate, TStock, TStockCreate, TStockCreateService, TSupply, TSupplyCreate, TSupplyGetById, TSupplyGetQuery, TSupplyUpdate, TUnit, TUnitCreate, TUnitGetQuery, TUnitUpdate, allowedChecklistStatus, allowedDays, allowedFrequency, allowedMonths, allowedPeriods, allowedRequestItemStatus, allowedStatus, allowedTypes, allowedWeekOfMonth, areaChecklistSchema, areaSchema, parentChecklistSchema, requestItemSchema, scheduleTaskSchema, stockSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaRepo, useAreaService, useHygieneDashboardController, useHygieneDashboardRepository, useParentChecklistController, useParentChecklistRepo, useRequestItemController, useRequestItemRepository, useRequestItemService, useScheduleTaskController, useScheduleTaskRepository, useScheduleTaskService, useStockController, useStockRepository, useStockService, useSupplyController, useSupplyRepository, useUnitController, useUnitRepository, useUnitService };
|