diff --git a/server/src/routes/timeslot.ts b/server/src/routes/timeslot.ts index 492e41d..b853481 100644 --- a/server/src/routes/timeslot.ts +++ b/server/src/routes/timeslot.ts @@ -8,15 +8,13 @@ import { client } from "../db"; import { DatabaseError } from "pg"; import Trainer from "../interfaces/trainer"; import { ReservedTimeslots, Timeslot, WeeklyTimeslot } from "../interfaces/timeslot"; -import { idSchema } from "../schemas"; +import { idSchema, timeSchema } from "../schemas"; dayjs.extend(isoWeek) dayjs.extend(utc) const router: Router = express.Router(); -const timeSchema = Joi.string().regex(/^\d{1,2}:\d{1,2}$/); - const timeslotFiltersSchema = Joi.object({ trainer: Joi.array().single().items( idSchema.required() diff --git a/server/src/schemas/index.ts b/server/src/schemas/index.ts index 5f72f91..024d5c0 100644 --- a/server/src/schemas/index.ts +++ b/server/src/schemas/index.ts @@ -1,3 +1,5 @@ import Joi from "joi" -export const idSchema = Joi.number().integer().positive(); \ No newline at end of file +export const idSchema = Joi.number().integer().positive(); + +export const timeSchema = Joi.string().regex(/^\d{1,2}:\d{1,2}$/); \ No newline at end of file