From d0911e94101f23a2157a01985dd0d91ca3b552d2 Mon Sep 17 00:00:00 2001 From: sopy Date: Tue, 12 Sep 2023 16:38:05 +0300 Subject: [PATCH] Set default topic in roadmapController Made 'PROGRAMMING' the default topic if an invalid topic is provided. This step provides a fallback mechanism which prevents route failure due to any potential input error related to the 'topic' key.. --- src/controllers/roadmapController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/roadmapController.ts b/src/controllers/roadmapController.ts index 9d26e9c..6353c1f 100644 --- a/src/controllers/roadmapController.ts +++ b/src/controllers/roadmapController.ts @@ -51,7 +51,7 @@ export async function createRoadmap(req: RequestWithBody, res: Response) { const db = new Database(); if (!topic || !Object.values(RoadmapTopic).includes(topic as RoadmapTopic)) - topic = null; + topic = RoadmapTopic.PROGRAMMING; isPublic = true; if (isDraft !== true && isDraft !== false) isDraft = false;