From 6a5572b0877c2df1a207c419c377501642814ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Zakrzewski?= Date: Fri, 22 Nov 2024 15:00:49 +0100 Subject: [PATCH] Update case.ts --- data-serving/data-service/src/controllers/case.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data-serving/data-service/src/controllers/case.ts b/data-serving/data-service/src/controllers/case.ts index 5eb973ff7..0e350c582 100644 --- a/data-serving/data-service/src/controllers/case.ts +++ b/data-serving/data-service/src/controllers/case.ts @@ -57,6 +57,9 @@ const caseFromDTO = async (receivedCase: CaseDTO) => { .map((b) => b._id); } + const geometry = aCase.location?.geometry; + if (!geometry.latitude || !geometry.longitude) delete aCase.location.geometry; + const user = await User.findOne({ email: receivedCase.curator?.email }); if (user) { logger.info(`User: ${JSON.stringify(user)}`) @@ -80,7 +83,6 @@ const caseFromDTO = async (receivedCase: CaseDTO) => { }; } } - aCase.bundleId = new ObjectId(aCase.bundleId) return aCase; }; @@ -1252,10 +1254,12 @@ export class CasesController { if (err.name === 'ValidationError') { res.status(422).json(err); return; + } else { + res.status(500).json(err); } + } else { res.status(500).json(err); } - res.status(500).json(err); return; } };