diff --git a/server/src/models/ScheduledSession.ts b/server/src/models/ScheduledSession.ts index 9dd6a6b..695e6d8 100644 --- a/server/src/models/ScheduledSession.ts +++ b/server/src/models/ScheduledSession.ts @@ -24,17 +24,8 @@ const scheduledSessionSchema = new Schema( type: Date, required: true, }, - clientName: { - type: String, - required: true, - }, - clientPhone: { - type: String, - required: true, - }, - clientEmail: { - type: String, - required: true, + client: { + type: Object, }, activeSessionId: { type: Schema.Types.ObjectId, diff --git a/server/src/routes/scheduledSessions.ts b/server/src/routes/scheduledSessions.ts index 860736c..795523b 100644 --- a/server/src/routes/scheduledSessions.ts +++ b/server/src/routes/scheduledSessions.ts @@ -79,11 +79,11 @@ scheduledSessionsRouter.get("/:buildId", async (req, res) => { scheduledSessionsRouter.post("/", async (req, res) => { const { buildId, startAt, client } = req.body; - if (!buildId || !startAt || !client) { + if (!buildId || !startAt) { return res.json({ status: "error", message: - "Parameters `compamyId`, `buildId`, `startAt`, `client` are required!", // Параметры `compamyId`, `buildId`, `startAt`, `client` обязательны! + "Parameters `buildId`, `startAt` are required!", // Параметры `compamyId`, `buildId`, `startAt`, `client` обязательны! }); } @@ -156,14 +156,15 @@ scheduledSessionsRouter.post("/", async (req, res) => { const scheduledSession = await ScheduledSession.create({ buildId, + client, startAt: startAtISO, endAt: endAtISO, - clientName: client.name, - clientEmail: client.email, - clientPhone: client.phone, }); - res.json({ status: "success", scheduledSession }); + res.json({ + status: "success", + url: `https://stream.graff.tech/scheduled/${scheduledSession.id}`, + }); }); scheduledSessionsRouter.put("/:id", async (req, res) => {