@7365admin1/module-hygiene 4.22.0 → 4.23.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
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5119980: Update module hygiene package
8
+
3
9
  ## 4.22.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -409,19 +409,20 @@ type TSupply = {
409
409
  name: string;
410
410
  unitOfMeasurement: string;
411
411
  qty: number;
412
+ attachment?: string;
412
413
  status?: "active" | "deleted";
413
414
  createdAt?: string;
414
415
  updatedAt?: string;
415
416
  deletedAt?: string;
416
417
  };
417
- type TSupplyCreate = Pick<TSupply, "site" | "serviceType" | "name" | "unitOfMeasurement">;
418
+ type TSupplyCreate = Pick<TSupply, "site" | "serviceType" | "name" | "unitOfMeasurement" | "attachment">;
418
419
  type TSupplyGetQuery = {
419
420
  page?: number;
420
421
  limit?: number;
421
422
  search?: string;
422
423
  } & Pick<TSupply, "site" | "serviceType">;
423
- type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty">;
424
- type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty">>;
424
+ type TSupplyGetById = Pick<TSupply, "_id" | "name" | "unitOfMeasurement" | "qty" | "attachment">;
425
+ type TSupplyUpdate = Partial<Pick<TSupply, "name" | "unitOfMeasurement" | "qty" | "attachment">>;
425
426
  declare const supplySchema: Joi.ObjectSchema<any>;
426
427
  declare function MSupply(value: TSupplyCreate): {
427
428
  site: string | ObjectId;
@@ -429,6 +430,7 @@ declare function MSupply(value: TSupplyCreate): {
429
430
  name: string;
430
431
  unitOfMeasurement: string;
431
432
  qty: number;
433
+ attachment: string | undefined;
432
434
  status: string;
433
435
  createdAt: string;
434
436
  updatedAt: string;
package/dist/index.js CHANGED
@@ -2549,6 +2549,7 @@ function MParentChecklist(value) {
2549
2549
 
2550
2550
  // src/repositories/hygiene-parent-checklist.repository.ts
2551
2551
  var import_mongodb7 = require("mongodb");
2552
+ var import_moment_timezone2 = __toESM(require("moment-timezone"));
2552
2553
  var import_node_server_utils14 = require("@7365admin1/node-server-utils");
2553
2554
  var import_core7 = require("@7365admin1/core");
2554
2555
  function useParentChecklistRepo() {
@@ -2578,10 +2579,8 @@ function useParentChecklistRepo() {
2578
2579
  async function createParentChecklist(value, session) {
2579
2580
  try {
2580
2581
  const currentDate = value.createdAt ? new Date(value.createdAt) : /* @__PURE__ */ new Date();
2581
- const startOfDay = new Date(currentDate);
2582
- startOfDay.setUTCHours(0, 0, 0, 0);
2583
- const endOfDay = new Date(currentDate);
2584
- endOfDay.setUTCHours(23, 59, 59, 999);
2582
+ const startOfDay = (0, import_moment_timezone2.default)(currentDate).tz("Asia/Singapore").startOf("day").toDate();
2583
+ const endOfDay = (0, import_moment_timezone2.default)(currentDate).tz("Asia/Singapore").endOf("day").toDate();
2585
2584
  const allServiceTypes = Object.values(import_core7.AppServiceType);
2586
2585
  const dateStr = currentDate.toISOString().split("T")[0];
2587
2586
  if (value.site) {
@@ -2932,11 +2931,8 @@ function useParentChecklistRepo() {
2932
2931
  }
2933
2932
  }
2934
2933
  async function getTodayParentChecklists() {
2935
- const now = /* @__PURE__ */ new Date();
2936
- const start = new Date(now);
2937
- start.setUTCHours(0, 0, 0, 0);
2938
- const end = new Date(now);
2939
- end.setUTCHours(23, 59, 59, 999);
2934
+ const start = (0, import_moment_timezone2.default)().tz("Asia/Singapore").startOf("day").toDate();
2935
+ const end = (0, import_moment_timezone2.default)().tz("Asia/Singapore").endOf("day").toDate();
2940
2936
  try {
2941
2937
  const items = await collection.find(
2942
2938
  { createdAt: { $gte: start, $lte: end } },
@@ -2949,11 +2945,8 @@ function useParentChecklistRepo() {
2949
2945
  }
2950
2946
  }
2951
2947
  async function getTodayParentChecklistsForAreaGen() {
2952
- const now = /* @__PURE__ */ new Date();
2953
- const start = new Date(now);
2954
- start.setUTCHours(0, 0, 0, 0);
2955
- const end = new Date(now);
2956
- end.setUTCHours(23, 59, 59, 999);
2948
+ const start = (0, import_moment_timezone2.default)().tz("Asia/Singapore").startOf("day").toDate();
2949
+ const end = (0, import_moment_timezone2.default)().tz("Asia/Singapore").endOf("day").toDate();
2957
2950
  try {
2958
2951
  const items = await collection.find(
2959
2952
  {
@@ -5012,7 +5005,8 @@ var supplySchema = import_joi10.default.object({
5012
5005
  site: import_joi10.default.string().hex().required(),
5013
5006
  serviceType: import_joi10.default.string().valid(...Object.values(import_core12.AppServiceType)).required(),
5014
5007
  name: import_joi10.default.string().required(),
5015
- unitOfMeasurement: import_joi10.default.string().required()
5008
+ unitOfMeasurement: import_joi10.default.string().required(),
5009
+ attachment: import_joi10.default.string().allow(null, "").optional()
5016
5010
  });
5017
5011
  function MSupply(value) {
5018
5012
  const { error } = supplySchema.validate(value);
@@ -5033,6 +5027,7 @@ function MSupply(value) {
5033
5027
  name: value.name,
5034
5028
  unitOfMeasurement: value.unitOfMeasurement,
5035
5029
  qty: 0,
5030
+ attachment: value.attachment,
5036
5031
  status: "active",
5037
5032
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5038
5033
  updatedAt: "",
@@ -5144,6 +5139,7 @@ function useSupplyRepository() {
5144
5139
  { $match: query },
5145
5140
  {
5146
5141
  $project: {
5142
+ attachment: 1,
5147
5143
  name: 1,
5148
5144
  qty: 1,
5149
5145
  status: 1
@@ -5192,6 +5188,7 @@ function useSupplyRepository() {
5192
5188
  { $match: query },
5193
5189
  {
5194
5190
  $project: {
5191
+ attachment: 1,
5195
5192
  name: 1,
5196
5193
  unitOfMeasurement: 1,
5197
5194
  qty: 1
@@ -5380,7 +5377,8 @@ function useSupplyController() {
5380
5377
  id: import_joi11.default.string().hex().required(),
5381
5378
  name: import_joi11.default.string().optional().allow("", null),
5382
5379
  unitOfMeasurement: import_joi11.default.string().optional().allow("", null),
5383
- qty: import_joi11.default.number().min(0).optional().allow("", null)
5380
+ qty: import_joi11.default.number().min(0).optional().allow("", null),
5381
+ attachment: import_joi11.default.string().optional().allow("", null)
5384
5382
  });
5385
5383
  const { error } = validation.validate(payload);
5386
5384
  if (error) {