@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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2261,7 +2261,7 @@ declare function useVehicleRepo(): {
|
|
|
2261
2261
|
createIndex: () => Promise<void>;
|
|
2262
2262
|
createTextIndex: () => Promise<void>;
|
|
2263
2263
|
add: (value: TVehicle, session?: ClientSession) => Promise<ObjectId>;
|
|
2264
|
-
getVehicles: ({ page, limit, search, sort, type, category, status, }: {
|
|
2264
|
+
getVehicles: ({ page, limit, search, sort, type, category, status, site, }: {
|
|
2265
2265
|
page?: number | undefined;
|
|
2266
2266
|
limit?: number | undefined;
|
|
2267
2267
|
search?: string | undefined;
|
|
@@ -2269,6 +2269,7 @@ declare function useVehicleRepo(): {
|
|
|
2269
2269
|
type?: string | undefined;
|
|
2270
2270
|
category?: string | undefined;
|
|
2271
2271
|
status?: string | undefined;
|
|
2272
|
+
site?: string | undefined;
|
|
2272
2273
|
}) => Promise<{
|
|
2273
2274
|
items: any[];
|
|
2274
2275
|
pages: number;
|
package/dist/index.js
CHANGED
|
@@ -15972,13 +15972,15 @@ function useVehicleRepo() {
|
|
|
15972
15972
|
sort = {},
|
|
15973
15973
|
type = "",
|
|
15974
15974
|
category = "",
|
|
15975
|
-
status = ""
|
|
15975
|
+
status = "",
|
|
15976
|
+
site = ""
|
|
15976
15977
|
}) {
|
|
15977
15978
|
page = page > 0 ? page - 1 : 0;
|
|
15978
15979
|
const baseQuery = {
|
|
15979
15980
|
...status && { status },
|
|
15980
15981
|
...type && { type },
|
|
15981
|
-
...category && { category }
|
|
15982
|
+
...category && { category },
|
|
15983
|
+
...site && { site: new import_mongodb42.ObjectId(site) }
|
|
15982
15984
|
};
|
|
15983
15985
|
let query = { ...baseQuery };
|
|
15984
15986
|
if (search)
|
|
@@ -16011,6 +16013,7 @@ function useVehicleRepo() {
|
|
|
16011
16013
|
recNo: 1,
|
|
16012
16014
|
nric: 1,
|
|
16013
16015
|
plateNumber: 1,
|
|
16016
|
+
site: 1,
|
|
16014
16017
|
createdAt: 1,
|
|
16015
16018
|
updatedAt: 1
|
|
16016
16019
|
}
|
|
@@ -16040,6 +16043,7 @@ function useVehicleRepo() {
|
|
|
16040
16043
|
unit: { $first: "$unit" },
|
|
16041
16044
|
unitName: { $first: "$unitName" },
|
|
16042
16045
|
nric: { $first: "$nric" },
|
|
16046
|
+
site: { $first: "$site" },
|
|
16043
16047
|
createdAt: { $min: "$createdAt" },
|
|
16044
16048
|
updatedAt: { $max: "$updatedAt" },
|
|
16045
16049
|
plates: {
|
|
@@ -16066,6 +16070,7 @@ function useVehicleRepo() {
|
|
|
16066
16070
|
unit: 1,
|
|
16067
16071
|
unitName: 1,
|
|
16068
16072
|
nric: 1,
|
|
16073
|
+
site: 1,
|
|
16069
16074
|
plates: {
|
|
16070
16075
|
$filter: {
|
|
16071
16076
|
input: "$plates",
|
|
@@ -23224,7 +23229,8 @@ function useVehicleController() {
|
|
|
23224
23229
|
order: import_joi48.default.string().optional().valid(...Object.values(SortOrder)),
|
|
23225
23230
|
type: import_joi48.default.string().optional().valid(...Object.values(VehicleType)).allow(null, ""),
|
|
23226
23231
|
category: import_joi48.default.string().optional().valid(...Object.values(VehicleCategory)).allow(null, ""),
|
|
23227
|
-
status: import_joi48.default.string().optional().valid(...Object.values(VehicleStatus)).allow(null, "")
|
|
23232
|
+
status: import_joi48.default.string().optional().valid(...Object.values(VehicleStatus)).allow(null, ""),
|
|
23233
|
+
site: import_joi48.default.string().hex().length(24).optional().allow(null, "")
|
|
23228
23234
|
});
|
|
23229
23235
|
const { error, value } = schema2.validate(req.query, {
|
|
23230
23236
|
abortEarly: false
|
|
@@ -23235,7 +23241,7 @@ function useVehicleController() {
|
|
|
23235
23241
|
next(new import_node_server_utils91.BadRequestError(messages));
|
|
23236
23242
|
return;
|
|
23237
23243
|
}
|
|
23238
|
-
const { search, page, limit, type, category, status, sort, order } = value;
|
|
23244
|
+
const { search, page, limit, type, category, status, sort, order, site } = value;
|
|
23239
23245
|
let sortObj;
|
|
23240
23246
|
if (sort === "updatedAt" /* UPDATED_AT */) {
|
|
23241
23247
|
sortObj = order === "asc" /* ASC */ ? { updatedAt: 1, createdAt: 1, _id: 1 } : { updatedAt: -1, createdAt: -1, _id: -1 };
|
|
@@ -23252,7 +23258,8 @@ function useVehicleController() {
|
|
|
23252
23258
|
// sort: sortObj,
|
|
23253
23259
|
type,
|
|
23254
23260
|
category,
|
|
23255
|
-
status
|
|
23261
|
+
status,
|
|
23262
|
+
site
|
|
23256
23263
|
});
|
|
23257
23264
|
res.json(data);
|
|
23258
23265
|
return;
|