@iservice365/module-hygiene 1.0.2 → 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,18 @@
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
+
9
+ ## 1.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - fa485c3: Update dependencies
14
+ - 3ac64f5: Fix export modules
15
+
3
16
  ## 1.0.2
4
17
 
5
18
  ### 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;
@@ -269,12 +269,13 @@ type TSupply = {
269
269
  name: string;
270
270
  unitOfMeasurement: string;
271
271
  qty: number;
272
+ status?: "active" | "deleted";
272
273
  createdAt?: string;
273
274
  updatedAt?: string;
274
275
  deletedAt?: string;
275
- status?: "active" | "deleted";
276
276
  };
277
- type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement" | "qty">;
277
+ type TSupplyCreate = Pick<TSupply, "site" | "name" | "unitOfMeasurement">;
278
+ type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty">;
278
279
  type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
279
280
  type TGetSupplysQuery = {
280
281
  page?: number;
@@ -287,8 +288,8 @@ declare function MSupply(value: TSupplyCreate): {
287
288
  name: string;
288
289
  unitOfMeasurement: string;
289
290
  qty: number;
290
- createdAt: Date;
291
291
  status: string;
292
+ createdAt: string;
292
293
  updatedAt: string;
293
294
  deletedAt: string;
294
295
  };
@@ -299,7 +300,7 @@ declare function useSupplyRepository(): {
299
300
  createUniqueIndex: () => Promise<void>;
300
301
  createSupply: (value: TSupplyCreate, session?: ClientSession) => Promise<ObjectId>;
301
302
  getSupplies: ({ page, limit, search, site, }: TGetSupplysQuery) => Promise<{}>;
302
- getSupplyById: (_id: string | ObjectId) => Promise<{}>;
303
+ getSupplyById: (_id: string | ObjectId, session?: ClientSession) => Promise<TSupplyGetById>;
303
304
  updateSupply: (_id: string | ObjectId, value: TSupplyUpdate, session?: ClientSession) => Promise<number>;
304
305
  deleteSupply: (_id: string | ObjectId, session?: ClientSession) => Promise<number>;
305
306
  };
@@ -312,4 +313,113 @@ declare function useSupplyController(): {
312
313
  deleteSupply: (req: Request, res: Response, next: NextFunction) => Promise<void>;
313
314
  };
314
315
 
315
- 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 };
316
+ type TStock = {
317
+ _id?: ObjectId;
318
+ site: string | ObjectId;
319
+ supply: string | ObjectId;
320
+ in?: number;
321
+ out?: number;
322
+ balance: number;
323
+ remarks?: string;
324
+ status?: "active" | "deleted";
325
+ createdAt?: string;
326
+ updatedAt?: string;
327
+ deletedAt?: string;
328
+ };
329
+ type TStockCreate = Pick<TStock, "site" | "supply" | "in" | "out" | "balance" | "remarks">;
330
+ type TStockCreateService = Pick<TStock, "site" | "supply" | "remarks"> & {
331
+ qty: number;
332
+ };
333
+ type TGetStocksQuery = {
334
+ page?: number;
335
+ limit?: number;
336
+ search?: string;
337
+ } & Pick<TStock, "site" | "supply">;
338
+ declare const stockSchema: Joi.ObjectSchema<any>;
339
+ declare function MStock(value: TStockCreate): {
340
+ site: string | ObjectId;
341
+ supply: string | ObjectId;
342
+ in: number;
343
+ out: number;
344
+ balance: number;
345
+ remarks: string;
346
+ createdAt: string;
347
+ status: string;
348
+ updatedAt: string;
349
+ deletedAt: string;
350
+ };
351
+
352
+ declare function useStockRepository(): {
353
+ createIndex: () => Promise<void>;
354
+ createStock: (value: TStockCreate, session?: ClientSession) => Promise<ObjectId>;
355
+ getStocksBySupplyId: ({ page, limit, search, site, supply, }: TGetStocksQuery) => Promise<{}>;
356
+ };
357
+
358
+ declare function useStockService(): {
359
+ createStock: (value: TStockCreateService, out?: boolean) => Promise<bson.ObjectId>;
360
+ };
361
+
362
+ declare function useStockController(): {
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>;
423
+ };
424
+
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 };