@iservice365/module-hygiene 1.0.3 → 1.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
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0f65fa2: Hygiene Supply Stock and Request Item - Initial Release
8
+
3
9
  ## 1.0.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ type TUnit = {
97
97
  deletedAt?: string;
98
98
  status?: "active" | "deleted";
99
99
  };
100
- type TUnitCreate = Partial<Pick<TUnit, "site" | "name">>;
100
+ type TUnitCreate = Pick<TUnit, "site" | "name">;
101
101
  type TUnitUpdate = Pick<TUnit, "name">;
102
102
  type TGetUnitsQuery = {
103
103
  page?: number;
@@ -106,8 +106,8 @@ type TGetUnitsQuery = {
106
106
  } & Pick<TUnit, "site">;
107
107
  declare const unitSchema: Joi.ObjectSchema<any>;
108
108
  declare function MUnit(value: TUnitCreate): {
109
- site: string | ObjectId | undefined;
110
- name: string | undefined;
109
+ site: string | ObjectId;
110
+ name: string;
111
111
  createdAt: Date;
112
112
  status: string;
113
113
  updatedAt: string;
@@ -274,7 +274,7 @@ type TSupply = {
274
274
  updatedAt?: string;
275
275
  deletedAt?: string;
276
276
  };
277
- type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement" | "qty">;
277
+ type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement">;
278
278
  type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty">;
279
279
  type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
280
280
  type TGetSupplysQuery = {
@@ -300,15 +300,11 @@ declare function useSupplyRepository(): {
300
300
  createUniqueIndex: () => Promise<void>;
301
301
  createSupply: (value: TSupplyCreate, session?: ClientSession) => Promise<ObjectId>;
302
302
  getSupplies: ({ page, limit, search, site, }: TGetSupplysQuery) => Promise<{}>;
303
- getSupplyById: (_id: string | ObjectId) => Promise<TSupplyGetById>;
303
+ getSupplyById: (_id: string | ObjectId, session?: ClientSession) => Promise<TSupplyGetById>;
304
304
  updateSupply: (_id: string | ObjectId, value: TSupplyUpdate, session?: ClientSession) => Promise<number>;
305
305
  deleteSupply: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
306
306
  };
307
307
 
308
- declare function useSupplyService(): {
309
- createSupply: (value: TSupplyCreate) => Promise<bson.ObjectId>;
310
- };
311
-
312
308
  declare function useSupplyController(): {
313
309
  createSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
314
310
  getSupplies: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -334,6 +330,11 @@ type TStockCreate = Pick<TStock, "site" | "supply" | "in" | "out" | "balance" |
334
330
  type TStockCreateService = Pick<TStock, "site" | "supply" | "remarks"> & {
335
331
  qty: number;
336
332
  };
333
+ type TGetStocksQuery = {
334
+ page?: number;
335
+ limit?: number;
336
+ search?: string;
337
+ } & Pick<TStock, "site" | "supply">;
337
338
  declare const stockSchema: Joi.ObjectSchema<any>;
338
339
  declare function MStock(value: TStockCreate): {
339
340
  site: string | ObjectId;
@@ -350,15 +351,75 @@ declare function MStock(value: TStockCreate): {
350
351
 
351
352
  declare function useStockRepository(): {
352
353
  createIndex: () => Promise<void>;
353
- createStock: (value: TStockCreate, session?: ClientSession) => Promise<bson.ObjectId>;
354
+ createStock: (value: TStockCreate, session?: ClientSession) => Promise<ObjectId>;
355
+ getStocksBySupplyId: ({ page, limit, search, site, supply, }: TGetStocksQuery) => Promise<{}>;
354
356
  };
355
357
 
356
358
  declare function useStockService(): {
357
- createStock: (value: TStockCreateService) => Promise<bson.ObjectId>;
359
+ createStock: (value: TStockCreateService, out?: boolean) => Promise<bson.ObjectId>;
358
360
  };
359
361
 
360
362
  declare function useStockController(): {
361
363
  createStock: (req: Request, res: Response, next: NextFunction) => Promise<void>;
364
+ getStocksBySupplyId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
365
+ };
366
+
367
+ declare const allowedRequestItemStatus: string[];
368
+ type TRequestItem = {
369
+ _id?: ObjectId;
370
+ site: string | ObjectId;
371
+ supply: string | ObjectId;
372
+ supplyName: string;
373
+ qty: number;
374
+ remarks?: string;
375
+ createdBy: string | ObjectId;
376
+ createdByName: string;
377
+ status?: (typeof allowedRequestItemStatus)[number];
378
+ createdAt?: string;
379
+ updatedAt?: string;
380
+ deletedAt?: string;
381
+ };
382
+ type TRequestItemCreate = Pick<TRequestItem, "site" | "supply" | "supplyName" | "qty" | "createdBy" | "createdByName">;
383
+ type TRequestItemCreateService = Pick<TRequestItem, "site" | "supply" | "qty" | "createdBy">;
384
+ type TRequestItemCreateByBatchService = Pick<TRequestItem, "site" | "createdBy"> & {
385
+ items: Pick<TRequestItem, "supply" | "qty">[];
386
+ };
387
+ type TGetRequestItemsQuery = {
388
+ page?: number;
389
+ limit?: number;
390
+ search?: string;
391
+ } & Pick<TRequestItem, "site">;
392
+ declare const requestItemSchema: Joi.ObjectSchema<any>;
393
+ declare function MRequestItem(value: TRequestItemCreate): {
394
+ site: string | ObjectId;
395
+ supply: string | ObjectId;
396
+ supplyName: string;
397
+ qty: number;
398
+ remarks: string;
399
+ createdBy: string | ObjectId;
400
+ createdByName: string;
401
+ status: string;
402
+ createdAt: string;
403
+ updatedAt: string;
404
+ deletedAt: string;
405
+ };
406
+
407
+ declare function useRequestItemRepository(): {
408
+ createIndex: () => Promise<void>;
409
+ createTextIndex: () => Promise<void>;
410
+ createRequestItem: (value: TRequestItemCreate, session?: ClientSession) => Promise<ObjectId>;
411
+ getRequestItems: ({ page, limit, search, site, }: TGetRequestItemsQuery) => Promise<{}>;
412
+ };
413
+
414
+ declare function useRequestItemService(): {
415
+ createRequestItem: (value: TRequestItemCreateService) => Promise<bson.ObjectId>;
416
+ createRequestItemByBatch: (value: TRequestItemCreateByBatchService) => Promise<bson.ObjectId[]>;
417
+ };
418
+
419
+ declare function useRequestItemController(): {
420
+ createRequestItem: (req: Request, res: Response, next: NextFunction) => Promise<void>;
421
+ createRequestItemByBatch: (req: Request, res: Response, next: NextFunction) => Promise<void>;
422
+ getRequestItems: (req: Request, res: Response, next: NextFunction) => Promise<void>;
362
423
  };
363
424
 
364
- export { MArea, MAreaChecklist, MParentChecklist, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaCreate, TAreaGetAreasForChecklist, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TGetSupplysQuery, TGetUnitsQuery, TParentChecklist, TStock, TStockCreate, TStockCreateService, TSupply, TSupplyCreate, TSupplyGetById, TSupplyUpdate, TUnit, TUnitCreate, TUnitUpdate, allowedChecklistStatus, allowedStatus, allowedTypes, areaChecklistSchema, areaSchema, parentChecklistSchema, stockSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaRepo, useAreaService, useParentChecklistController, useParentChecklistRepo, useStockController, useStockRepository, useStockService, useSupplyController, useSupplyRepository, useSupplyService, useUnitController, useUnitRepository, useUnitService };
425
+ export { MArea, MAreaChecklist, MParentChecklist, MRequestItem, MStock, MSupply, MUnit, TArea, TAreaChecklist, TAreaChecklistCreate, TAreaChecklistUnits, TAreaChecklistUnitsUpdate, TAreaCreate, TAreaGetAreasForChecklist, TAreaGetQuery, TAreaUnits, TAreaUpdate, TAreaUpdateChecklist, TCleaningScheduleArea, TGetRequestItemsQuery, TGetStocksQuery, TGetSupplysQuery, TGetUnitsQuery, TParentChecklist, TRequestItem, TRequestItemCreate, TRequestItemCreateByBatchService, TRequestItemCreateService, TStock, TStockCreate, TStockCreateService, TSupply, TSupplyCreate, TSupplyGetById, TSupplyUpdate, TUnit, TUnitCreate, TUnitUpdate, allowedChecklistStatus, allowedRequestItemStatus, allowedStatus, allowedTypes, areaChecklistSchema, areaSchema, parentChecklistSchema, requestItemSchema, stockSchema, supplySchema, unitSchema, useAreaChecklistController, useAreaChecklistRepo, useAreaChecklistService, useAreaController, useAreaRepo, useAreaService, useParentChecklistController, useParentChecklistRepo, useRequestItemController, useRequestItemRepository, useRequestItemService, useStockController, useStockRepository, useStockService, useSupplyController, useSupplyRepository, useUnitController, useUnitRepository, useUnitService };