@iservice365/module-hygiene 1.3.0 → 1.5.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 +31 -12
- package/dist/index.js +381 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +376 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Joi from 'joi';
|
|
2
2
|
import * as mongodb from 'mongodb';
|
|
3
3
|
import { ObjectId, ClientSession } from 'mongodb';
|
|
4
|
-
import { Request, Response, NextFunction } from 'express';
|
|
5
4
|
import * as bson from 'bson';
|
|
5
|
+
import { Request, Response, NextFunction } from 'express';
|
|
6
6
|
|
|
7
7
|
declare const allowedTypes: string[];
|
|
8
8
|
declare const allowedStatus: string[];
|
|
@@ -30,7 +30,6 @@ type TAreaGetQuery = {
|
|
|
30
30
|
} & Pick<TArea, "site">;
|
|
31
31
|
type TAreaCreate = Pick<TArea, "site" | "name" | "type" | "set" | "units">;
|
|
32
32
|
type TAreaUpdate = Partial<Pick<TArea, "name" | "type" | "set" | "units">>;
|
|
33
|
-
type TAreaGetAreasForChecklist = Pick<TArea, "site" | "type">;
|
|
34
33
|
type TAreaUpdateChecklist = {
|
|
35
34
|
units: TAreaUnits[];
|
|
36
35
|
};
|
|
@@ -53,8 +52,9 @@ declare function useAreaRepo(): {
|
|
|
53
52
|
createUniqueIndex: () => Promise<void>;
|
|
54
53
|
createArea: (value: TAreaCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
55
54
|
getAreas: ({ page, limit, search, site, }: TAreaGetQuery) => Promise<{}>;
|
|
56
|
-
getAreasForChecklist: (
|
|
55
|
+
getAreasForChecklist: (site: string | ObjectId) => Promise<{}>;
|
|
57
56
|
getAreaById: (_id: string | ObjectId) => Promise<{}>;
|
|
57
|
+
getAreaByMultipleId: (_id: string[] | ObjectId[]) => Promise<bson.Document[]>;
|
|
58
58
|
verifyAreaByUnitId: (unitId: string | ObjectId) => Promise<{}>;
|
|
59
59
|
updateArea: (_id: string | ObjectId, value: TAreaUpdate, session?: ClientSession) => Promise<number>;
|
|
60
60
|
updateAreaChecklist: (unitId: string | ObjectId, name: string, session?: ClientSession) => Promise<number>;
|
|
@@ -181,6 +181,7 @@ declare const allowedChecklistStatus: string[];
|
|
|
181
181
|
type TCleaningScheduleArea = {
|
|
182
182
|
_id?: ObjectId;
|
|
183
183
|
schedule: string | ObjectId;
|
|
184
|
+
area: string | ObjectId;
|
|
184
185
|
name: string;
|
|
185
186
|
type: (typeof allowedTypes)[number];
|
|
186
187
|
checklist: TAreaChecklist[];
|
|
@@ -208,6 +209,7 @@ type TAreaChecklistUnitsUpdate = Pick<TAreaChecklistUnits, "remarks" | "complete
|
|
|
208
209
|
declare const areaChecklistSchema: Joi.ObjectSchema<any>;
|
|
209
210
|
declare function MAreaChecklist(value: TCleaningScheduleArea): {
|
|
210
211
|
schedule: string | ObjectId;
|
|
212
|
+
area: string | ObjectId;
|
|
211
213
|
name: string;
|
|
212
214
|
type: string;
|
|
213
215
|
checklist: TAreaChecklist[];
|
|
@@ -435,7 +437,6 @@ declare function useRequestItemController(): {
|
|
|
435
437
|
|
|
436
438
|
declare const allowedFrequency: string[];
|
|
437
439
|
declare const allowedDays: string[];
|
|
438
|
-
declare const allowedQuarter: string[];
|
|
439
440
|
declare const allowedWeekOfMonth: string[];
|
|
440
441
|
declare const allowedMonths: string[];
|
|
441
442
|
type TScheduleTask = {
|
|
@@ -443,10 +444,11 @@ type TScheduleTask = {
|
|
|
443
444
|
site: string | ObjectId;
|
|
444
445
|
title: string;
|
|
445
446
|
frequency: (typeof allowedFrequency)[number];
|
|
446
|
-
|
|
447
|
+
time: string;
|
|
448
|
+
day?: (typeof allowedDays)[number][];
|
|
447
449
|
weekOfMonth?: (typeof allowedWeekOfMonth)[number];
|
|
448
|
-
quarter?: (typeof allowedQuarter)[number];
|
|
449
450
|
month?: (typeof allowedMonths)[number];
|
|
451
|
+
date?: number;
|
|
450
452
|
description?: string;
|
|
451
453
|
areas: {
|
|
452
454
|
name: string;
|
|
@@ -457,9 +459,9 @@ type TScheduleTask = {
|
|
|
457
459
|
updatedAt?: string | Date;
|
|
458
460
|
deletedAt?: string | Date;
|
|
459
461
|
};
|
|
460
|
-
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "title" | "frequency" | "day" | "weekOfMonth" | "
|
|
461
|
-
type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "frequency" | "day" | "weekOfMonth" | "
|
|
462
|
-
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "frequency" | "day" | "weekOfMonth" | "
|
|
462
|
+
type TScheduleTaskCreate = Pick<TScheduleTask, "site" | "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas">;
|
|
463
|
+
type TScheduleTaskUpdate = Partial<Pick<TScheduleTask, "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas">>;
|
|
464
|
+
type TScheduleTaskGetById = Pick<TScheduleTask, "title" | "frequency" | "time" | "day" | "weekOfMonth" | "month" | "date" | "description" | "areas" | "status" | "createdAt">;
|
|
463
465
|
type TGetScheduleTasksQuery = {
|
|
464
466
|
page?: number;
|
|
465
467
|
limit?: number;
|
|
@@ -470,10 +472,11 @@ declare function MScheduleTask(value: TScheduleTaskCreate): {
|
|
|
470
472
|
site: string | ObjectId;
|
|
471
473
|
title: string;
|
|
472
474
|
frequency: string;
|
|
473
|
-
|
|
475
|
+
time: string;
|
|
476
|
+
day: string[] | undefined;
|
|
474
477
|
weekOfMonth: string | undefined;
|
|
475
|
-
quarter: string | undefined;
|
|
476
478
|
month: string | undefined;
|
|
479
|
+
date: number | undefined;
|
|
477
480
|
description: string | undefined;
|
|
478
481
|
areas: {
|
|
479
482
|
name: string;
|
|
@@ -490,15 +493,31 @@ declare function useScheduleTaskRepository(): {
|
|
|
490
493
|
createTextIndex: () => Promise<void>;
|
|
491
494
|
createScheduleTask: (value: TScheduleTaskCreate, session?: ClientSession) => Promise<ObjectId>;
|
|
492
495
|
getScheduleTasks: ({ page, limit, search, site, }: TGetScheduleTasksQuery) => Promise<{}>;
|
|
496
|
+
getAllScheduleTask: () => Promise<TScheduleTask[]>;
|
|
497
|
+
getTasksForScheduleTask: ({ page, limit, search, site, }: TGetScheduleTasksQuery) => Promise<{}>;
|
|
493
498
|
getScheduleTaskById: (_id: string | ObjectId, session?: ClientSession) => Promise<TScheduleTaskGetById>;
|
|
494
499
|
updateScheduleTask: (_id: string | ObjectId, value: TScheduleTaskUpdate, session?: ClientSession) => Promise<number>;
|
|
495
500
|
};
|
|
496
501
|
|
|
502
|
+
declare function useScheduleTaskService(): {
|
|
503
|
+
checkScheduleConditions: (schedule: any, currentDate?: Date) => boolean;
|
|
504
|
+
processScheduledTasks: (currentDate?: Date) => Promise<{
|
|
505
|
+
processed: number;
|
|
506
|
+
validated: number;
|
|
507
|
+
tasks?: undefined;
|
|
508
|
+
} | {
|
|
509
|
+
processed: number;
|
|
510
|
+
validated: number;
|
|
511
|
+
tasks: TScheduleTask[];
|
|
512
|
+
}>;
|
|
513
|
+
};
|
|
514
|
+
|
|
497
515
|
declare function useScheduleTaskController(): {
|
|
498
516
|
createScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
499
517
|
getScheduleTasks: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
518
|
+
getTasksForScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
500
519
|
getScheduleTaskById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
501
520
|
updateScheduleTask: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
502
521
|
};
|
|
503
522
|
|
|
504
|
-
export { MArea, MAreaChecklist, MParentChecklist, MRequestItem, MScheduleTask, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaCreate,
|
|
523
|
+
export { MArea, MAreaChecklist, MParentChecklist, MRequestItem, MScheduleTask, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaCreate, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TGetRequestItemById, TGetRequestItemsQuery, TGetScheduleTasksQuery, TGetStocksQuery, TGetSupplysQuery, TGetUnitsQuery, TParentChecklist, TRequestItem, TRequestItemCreate, TRequestItemCreateByBatchService, TRequestItemCreateService, TScheduleTask, TScheduleTaskCreate, TScheduleTaskGetById, TScheduleTaskUpdate, TStock, TStockCreate, TStockCreateService, TSupply, TSupplyCreate, TSupplyGetById, TSupplyUpdate, TUnit, TUnitCreate, TUnitUpdate, allowedChecklistStatus, allowedDays, allowedFrequency, allowedMonths, allowedRequestItemStatus, allowedStatus, allowedTypes, allowedWeekOfMonth, areaChecklistSchema, areaSchema, parentChecklistSchema, requestItemSchema, scheduleTaskSchema, stockSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaRepo, useAreaService, useParentChecklistController, useParentChecklistRepo, useRequestItemController, useRequestItemRepository, useRequestItemService, useScheduleTaskController, useScheduleTaskRepository, useScheduleTaskService, useStockController, useStockRepository, useStockService, useSupplyController, useSupplyRepository, useUnitController, useUnitRepository, useUnitService };
|