From 775857e231f58a43566704c2a1f38d46cb430138 Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Fri, 12 Jul 2024 16:16:43 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=AD=20checks=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/sprintController.ts | 2 +- src/services/sprintService.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/sprintController.ts b/src/controllers/sprintController.ts index 150d617..4859d97 100644 --- a/src/controllers/sprintController.ts +++ b/src/controllers/sprintController.ts @@ -11,7 +11,7 @@ export const createSprint = async (req: Request, res: Response, next: NextFuncti res.status(201).json({ success: true, - message: "New sprint created", + message: "New Sprint created", sprint: newSprint, }); diff --git a/src/services/sprintService.ts b/src/services/sprintService.ts index 82ea25d..2438aee 100644 --- a/src/services/sprintService.ts +++ b/src/services/sprintService.ts @@ -8,6 +8,10 @@ class SprintService { async createSprint(sprintData: SprintBodyInput): Promise { const { name, description, start_date, end_date, status } = sprintData; + if (!name.trim()) { + throw new ErrorHandlerClass("Sprint name is required", 400); + } + const organization = await sprintRepository.findOrganization(); if (!organization) {