Skip to content

Commit

Permalink
Event add controller changed (#21)
Browse files Browse the repository at this point in the history
* ADD team delete route

* Health check updated

* sayHello bug fixed

* team delete updated

* comment removed

* Logged in user response updated

* add event controller changed

---------

Co-authored-by: Raj <rajdristant007@gmail.com>
Co-authored-by: Raj <63448767+Raj217@users.noreply.github.com>
Co-authored-by: Priyabrat  Duarah <priyabrat@Priyabrats-MacBook-Air.local>
  • Loading branch information
4 people authored Jan 26, 2024
1 parent e1cea2d commit 093a0e3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/controllers/event/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ const createEvent: Interfaces.Controller.Async = async (req, res, next) => {
const { organizers, managers }: { organizers: [string]; managers: [string] } =
req.body;

let connectOrganiser: {
userId: string;
}[] = [];
let connectManager: {
userId: string;
}[] = [];

if (organizers) {
if (!organizers.every((organizer) => organizer.length === 24)) {
return next(Errors.Module.invalidInput);
Expand All @@ -103,6 +110,7 @@ const createEvent: Interfaces.Controller.Async = async (req, res, next) => {
if (!userIdExist) {
return next(Errors.User.userNotFound);
}
connectOrganiser = await Utils.Event.connectId(organizers);
}

if (managers) {
Expand All @@ -115,12 +123,9 @@ const createEvent: Interfaces.Controller.Async = async (req, res, next) => {
if (!userIdExist) {
return next(Errors.User.userNotFound);
}
connectManager = await Utils.Event.connectId(managers);
}

const connectOrganiser = await Utils.Event.connectId(organizers);

const connectManager = await Utils.Event.connectId(managers);

const event = await prisma.event.create({
data: {
description,
Expand Down

0 comments on commit 093a0e3

Please sign in to comment.