From 99d90ad2aee09fecc96c847f836e698d9c08ea19 Mon Sep 17 00:00:00 2001 From: tamalCodes Date: Tue, 12 Mar 2024 11:37:06 +0530 Subject: [PATCH] fix: changes for online mode handling --- routes/events/Event.js | 20 ++++++++++++++------ schema/events/EventSchema.js | 8 ++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/routes/events/Event.js b/routes/events/Event.js index 5ef09bc..36e4233 100644 --- a/routes/events/Event.js +++ b/routes/events/Event.js @@ -37,12 +37,20 @@ router.post("/create", async (req, res) => { !uid || !data.description || !data.coverImage || - !data.mode || - !data.city || - !data.state || - !data.country || - !data.address || - !data.mapIframe + !data.mode + ) { + return res + .status(STATUSCODE.BAD_REQUEST) + .json({ message: "Missing Required Fields" }); + } + + if ( + data.mode === "Offline" && + (!data.city || + !data.state || + !data.country || + !data.address || + !data.mapIframe) ) { return res .status(STATUSCODE.BAD_REQUEST) diff --git a/schema/events/EventSchema.js b/schema/events/EventSchema.js index 00812b2..ead6ba0 100644 --- a/schema/events/EventSchema.js +++ b/schema/events/EventSchema.js @@ -59,6 +59,14 @@ const EventSchema = new mongoose.Schema({ type: String, trim: true, }, + platform: { + type: String, + trim: true, + }, + platformLink: { + type: String, + trim: true, + }, // date: { // type: Date, // required: true,