This commit is contained in:
2024-01-23 14:34:09 +05:00
parent c9e8de4d83
commit acae2e5a4c
2 changed files with 9 additions and 17 deletions
+2 -11
View File
@@ -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,
+7 -6
View File
@@ -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) => {