@7365admin1/core 3.34.4-staging.17 → 3.34.4-staging.18
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.d.ts +3 -3
- package/dist/index.js +31 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6104,8 +6104,8 @@ declare function useNfcPatrolLogRepo(): {
|
|
|
6104
6104
|
date?: string | undefined;
|
|
6105
6105
|
type?: "month" | undefined;
|
|
6106
6106
|
route?: {
|
|
6107
|
-
_id
|
|
6108
|
-
startTime
|
|
6107
|
+
_id?: string | ObjectId | undefined;
|
|
6108
|
+
startTime?: string | undefined;
|
|
6109
6109
|
} | undefined;
|
|
6110
6110
|
}, session?: ClientSession) => Promise<{
|
|
6111
6111
|
items: any[];
|
|
@@ -6136,7 +6136,7 @@ declare function useNfcPatrolLogService(): {
|
|
|
6136
6136
|
|
|
6137
6137
|
declare function useNfcPatrolLogController(): {
|
|
6138
6138
|
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6139
|
-
getAllBySite: (req: Request, res: Response, next: NextFunction) => Promise<void
|
|
6139
|
+
getAllBySite: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
6140
6140
|
completeCheckpoint: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6141
6141
|
getLog: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6142
6142
|
sign: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -58589,13 +58589,9 @@ function useNfcPatrolLogRepo() {
|
|
|
58589
58589
|
};
|
|
58590
58590
|
if (date) {
|
|
58591
58591
|
if (type === "month") {
|
|
58592
|
-
const [year, month] = date.split("-").map(Number);
|
|
58593
|
-
const endDay = new Date(year, month, 0).getDate();
|
|
58594
58592
|
query.date = {
|
|
58595
|
-
$gte: `${
|
|
58596
|
-
$lte: `${
|
|
58597
|
-
endDay
|
|
58598
|
-
).padStart(2, "0")}`
|
|
58593
|
+
$gte: `${date}-01-01`,
|
|
58594
|
+
$lte: `${date}-12-31`
|
|
58599
58595
|
};
|
|
58600
58596
|
} else {
|
|
58601
58597
|
query.date = date;
|
|
@@ -58916,49 +58912,52 @@ function useNfcPatrolLogController() {
|
|
|
58916
58912
|
page: import_joi111.default.number().integer().min(1).default(1),
|
|
58917
58913
|
limit: import_joi111.default.number().integer().min(1).max(100).default(10),
|
|
58918
58914
|
site: import_joi111.default.string().length(24).hex().required(),
|
|
58919
|
-
date: import_joi111.default.string().pattern(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])
|
|
58920
|
-
"string.pattern.base": "Date must be
|
|
58915
|
+
date: import_joi111.default.string().pattern(/^\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01]))?)?$/).optional().messages({
|
|
58916
|
+
"string.pattern.base": "Date must be YYYY or YYYY-MM or YYYY-MM-DD"
|
|
58921
58917
|
}),
|
|
58922
58918
|
type: import_joi111.default.string().valid("month").optional(),
|
|
58923
58919
|
route: import_joi111.default.object({
|
|
58924
|
-
_id: import_joi111.default.string().length(24).hex().
|
|
58925
|
-
startTime: import_joi111.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).
|
|
58926
|
-
|
|
58920
|
+
_id: import_joi111.default.string().length(24).hex().optional(),
|
|
58921
|
+
startTime: import_joi111.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().messages({
|
|
58922
|
+
"string.pattern.base": "startTime must be in HH:mm 24-hour format"
|
|
58923
|
+
})
|
|
58924
|
+
}).min(1).optional()
|
|
58927
58925
|
});
|
|
58928
58926
|
const query = {
|
|
58927
|
+
page: req.query.page,
|
|
58928
|
+
limit: req.query.limit,
|
|
58929
58929
|
site: req.query.site,
|
|
58930
58930
|
date: req.query.date,
|
|
58931
58931
|
type: req.query.type,
|
|
58932
|
-
route: {
|
|
58933
|
-
_id: req.query["route._id"],
|
|
58934
|
-
startTime: req.query["route.startTime"]
|
|
58935
|
-
}
|
|
58932
|
+
route: req.query["route._id"] || req.query["route.startTime"] ? {
|
|
58933
|
+
...req.query["route._id"] ? { _id: req.query["route._id"] } : {},
|
|
58934
|
+
...req.query["route.startTime"] ? { startTime: req.query["route.startTime"] } : {}
|
|
58935
|
+
} : void 0
|
|
58936
58936
|
};
|
|
58937
58937
|
const { error, value } = validation.validate(query, {
|
|
58938
|
-
abortEarly: false
|
|
58938
|
+
abortEarly: false,
|
|
58939
|
+
allowUnknown: true,
|
|
58940
|
+
stripUnknown: true
|
|
58939
58941
|
});
|
|
58940
58942
|
if (error) {
|
|
58941
|
-
|
|
58942
|
-
|
|
58943
|
-
|
|
58944
|
-
|
|
58943
|
+
return next(
|
|
58944
|
+
new import_node_server_utils200.BadRequestError(
|
|
58945
|
+
error.details.map((d) => d.message).join(", ")
|
|
58946
|
+
)
|
|
58947
|
+
);
|
|
58945
58948
|
}
|
|
58946
|
-
const { page, limit, site, date, type, route } = value;
|
|
58947
58949
|
try {
|
|
58948
58950
|
const data = await _getAllBySite({
|
|
58949
|
-
page,
|
|
58950
|
-
limit,
|
|
58951
|
-
site,
|
|
58952
|
-
date,
|
|
58953
|
-
type,
|
|
58954
|
-
route
|
|
58951
|
+
page: value.page,
|
|
58952
|
+
limit: value.limit,
|
|
58953
|
+
site: value.site,
|
|
58954
|
+
date: value.date,
|
|
58955
|
+
type: value.type,
|
|
58956
|
+
route: value.route
|
|
58955
58957
|
});
|
|
58956
|
-
res.status(200).json(data);
|
|
58957
|
-
return;
|
|
58958
|
+
return res.status(200).json(data);
|
|
58958
58959
|
} catch (error2) {
|
|
58959
|
-
|
|
58960
|
-
next(error2);
|
|
58961
|
-
return;
|
|
58960
|
+
return next(error2);
|
|
58962
58961
|
}
|
|
58963
58962
|
}
|
|
58964
58963
|
async function completeCheckpoint(req, res, next) {
|