From 517a6cc701bb5d58d99652debd67996870574a17 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Thu, 28 Oct 2021 13:06:53 +0530 Subject: [PATCH] deep copy API bug fix --- src/user-profile/profile-routes.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/user-profile/profile-routes.ts b/src/user-profile/profile-routes.ts index a23e2a5..c6ebb91 100644 --- a/src/user-profile/profile-routes.ts +++ b/src/user-profile/profile-routes.ts @@ -38,7 +38,6 @@ userProfileRoutes.get('/deep-copy/', jwtAuthentication, async (request, response _id: { $in: user.categories.map(id => new ObjectId(id)) } }).toArray(); - try { for (let i = 0; i < allCategories.length; i += 1) { if (allCategories[i].shelves) { @@ -63,6 +62,10 @@ userProfileRoutes.get('/deep-copy/', jwtAuthentication, async (request, response ...allCategories[i], shelves, }); + } else { + allDeepCategories.push({ + ...allCategories[i]; + }) } } } catch {