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) {