@7365admin1/core 2.78.0 → 2.79.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/dist/index.mjs CHANGED
@@ -15725,13 +15725,15 @@ function useVehicleRepo() {
15725
15725
  sort = {},
15726
15726
  type = "",
15727
15727
  category = "",
15728
- status = ""
15728
+ status = "",
15729
+ site = ""
15729
15730
  }) {
15730
15731
  page = page > 0 ? page - 1 : 0;
15731
15732
  const baseQuery = {
15732
15733
  ...status && { status },
15733
15734
  ...type && { type },
15734
- ...category && { category }
15735
+ ...category && { category },
15736
+ ...site && { site: new ObjectId42(site) }
15735
15737
  };
15736
15738
  let query = { ...baseQuery };
15737
15739
  if (search)
@@ -15764,6 +15766,7 @@ function useVehicleRepo() {
15764
15766
  recNo: 1,
15765
15767
  nric: 1,
15766
15768
  plateNumber: 1,
15769
+ site: 1,
15767
15770
  createdAt: 1,
15768
15771
  updatedAt: 1
15769
15772
  }
@@ -15793,6 +15796,7 @@ function useVehicleRepo() {
15793
15796
  unit: { $first: "$unit" },
15794
15797
  unitName: { $first: "$unitName" },
15795
15798
  nric: { $first: "$nric" },
15799
+ site: { $first: "$site" },
15796
15800
  createdAt: { $min: "$createdAt" },
15797
15801
  updatedAt: { $max: "$updatedAt" },
15798
15802
  plates: {
@@ -15819,6 +15823,7 @@ function useVehicleRepo() {
15819
15823
  unit: 1,
15820
15824
  unitName: 1,
15821
15825
  nric: 1,
15826
+ site: 1,
15822
15827
  plates: {
15823
15828
  $filter: {
15824
15829
  input: "$plates",
@@ -23035,7 +23040,8 @@ function useVehicleController() {
23035
23040
  order: Joi48.string().optional().valid(...Object.values(SortOrder)),
23036
23041
  type: Joi48.string().optional().valid(...Object.values(VehicleType)).allow(null, ""),
23037
23042
  category: Joi48.string().optional().valid(...Object.values(VehicleCategory)).allow(null, ""),
23038
- status: Joi48.string().optional().valid(...Object.values(VehicleStatus)).allow(null, "")
23043
+ status: Joi48.string().optional().valid(...Object.values(VehicleStatus)).allow(null, ""),
23044
+ site: Joi48.string().hex().length(24).optional().allow(null, "")
23039
23045
  });
23040
23046
  const { error, value } = schema2.validate(req.query, {
23041
23047
  abortEarly: false
@@ -23046,7 +23052,7 @@ function useVehicleController() {
23046
23052
  next(new BadRequestError87(messages));
23047
23053
  return;
23048
23054
  }
23049
- const { search, page, limit, type, category, status, sort, order } = value;
23055
+ const { search, page, limit, type, category, status, sort, order, site } = value;
23050
23056
  let sortObj;
23051
23057
  if (sort === "updatedAt" /* UPDATED_AT */) {
23052
23058
  sortObj = order === "asc" /* ASC */ ? { updatedAt: 1, createdAt: 1, _id: 1 } : { updatedAt: -1, createdAt: -1, _id: -1 };
@@ -23063,7 +23069,8 @@ function useVehicleController() {
23063
23069
  // sort: sortObj,
23064
23070
  type,
23065
23071
  category,
23066
- status
23072
+ status,
23073
+ site
23067
23074
  });
23068
23075
  res.json(data);
23069
23076
  return;