fix discarded validation, tighten types
This commit is contained in:
1 parent
456237ba4e
commit
42f6c42ae1
2 files changed
+3
-3
No files matched your search
@@ -33,11 +33,11 @@ class MaintenanceWindowController {
|
|||||||
};
|
};
|
||||||
getMaintenanceWindowById = async (req: Request, res: Response, next: NextFunction) => {
|
getMaintenanceWindowById = async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
getMaintenanceWindowByIdParamValidation.parse(req.params);
|
const validatedParams = getMaintenanceWindowByIdParamValidation.parse(req.params);
|
||||||
|
|
||||||
const teamId = requireTeamId(req.user?.teamId);
|
const teamId = requireTeamId(req.user?.teamId);
|
||||||
|
|
||||||
const maintenanceWindow = await this.maintenanceWindowService.getMaintenanceWindowById({ id: req.params.id as string, teamId });
|
const maintenanceWindow = await this.maintenanceWindowService.getMaintenanceWindowById({ id: validatedParams.id, teamId });
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const editMaintenanceByIdWindowBodyValidation = z.object({
|
|||||||
start: dateToString.optional(),
|
start: dateToString.optional(),
|
||||||
end: dateToString.optional(),
|
end: dateToString.optional(),
|
||||||
expiry: dateToString.optional(),
|
expiry: dateToString.optional(),
|
||||||
monitors: z.array(z.unknown()).optional(),
|
monitors: z.array(z.string()).optional(),
|
||||||
duration: z.number().optional(),
|
duration: z.number().optional(),
|
||||||
durationUnit: z.enum(["seconds", "minutes", "hours", "days"]).optional(),
|
durationUnit: z.enum(["seconds", "minutes", "hours", "days"]).optional(),
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user