From 1eafa8af23a6be104bd003dfdea447c355ee902a Mon Sep 17 00:00:00 2001 From: kj1352 Date: Tue, 26 Oct 2021 15:37:40 +0530 Subject: [PATCH] Returning IDs for category and shelf on addition of new record --- src/user-profile/category-routes.ts | 3 ++- src/user-profile/shelf-routes.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/user-profile/category-routes.ts b/src/user-profile/category-routes.ts index f74c7b7..92c9436 100644 --- a/src/user-profile/category-routes.ts +++ b/src/user-profile/category-routes.ts @@ -71,7 +71,8 @@ categoryRoutes.post('/add/', jwtAuthentication, async (request, response) => { } }); - response.sendStatus(200); + response.send(200); + response.send(newCategory.insertedId.toHexString()); } catch(e) { response.sendStatus(500); return; diff --git a/src/user-profile/shelf-routes.ts b/src/user-profile/shelf-routes.ts index d6d29d6..98d1813 100644 --- a/src/user-profile/shelf-routes.ts +++ b/src/user-profile/shelf-routes.ts @@ -87,7 +87,8 @@ shelfRoutes.post('/add/', jwtAuthentication, async (request, response) => { }); if (updatedCategory) { - response.sendStatus(200); + response.status(200); + response.send(newShelf.insertedId); } else { response.sendStatus(500); }