Skip to content

Commit

Permalink
Update case.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislaw-zakrzewski committed Nov 22, 2024
1 parent cece69f commit 6a5572b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions data-serving/data-service/src/controllers/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`)
Expand All @@ -80,7 +83,6 @@ const caseFromDTO = async (receivedCase: CaseDTO) => {
};
}
}
aCase.bundleId = new ObjectId(aCase.bundleId)

return aCase;
};
Expand Down Expand Up @@ -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;
}
};
Expand Down

0 comments on commit 6a5572b

Please sign in to comment.