From 6a18015d2dbf8603e10e4bfcaa46b43ff3fa944c Mon Sep 17 00:00:00 2001 From: Alexandra Dumitru Date: Fri, 8 Apr 2022 14:40:44 +0300 Subject: [PATCH] fix: removing an issuance from the unit deletes it from the datalayer --- src/controllers/units.controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controllers/units.controller.js b/src/controllers/units.controller.js index 1516c63e..f30adbd5 100644 --- a/src/controllers/units.controller.js +++ b/src/controllers/units.controller.js @@ -308,6 +308,9 @@ export const update = async (req, res) => { updatedRecord.issuance.id = uuidv4(); updatedRecord.issuance.orgUid = orgUid; } + } else { + updatedRecord.issuance = originalRecord.issuance; + updatedRecord.issuanceId = null; } // merge the new record into the old record