diff --git a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java index c2af9ef31..a97df83c5 100755 --- a/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java +++ b/java/registry/src/main/java/dev/sunbirdrc/registry/service/impl/RegistryServiceImpl.java @@ -309,9 +309,6 @@ private void generateCredentials(JsonNode rootNode, JsonNode inputNode, String v public void updateEntity(Shard shard, String userId, String id, String jsonString, boolean skipSignature) throws Exception { JsonNode inputNode = objectMapper.readTree(jsonString); String entityType = inputNode.fields().next().getKey(); - if (encryptionEnabled) { - inputNode = encryptionHelper.getEncryptedJson(inputNode); - } systemFieldsHelper.ensureUpdateAuditFields(entityType, inputNode.get(entityType), userId); DatabaseProvider databaseProvider = shard.getDatabaseProvider(); @@ -369,6 +366,10 @@ public void updateEntity(Shard shard, String userId, String id, String jsonStrin generateCredentials(mergedNode, inputNode, entityType); } + if (encryptionEnabled) { + inputNode = encryptionHelper.getEncryptedJson(inputNode); + } + if (entityType.equals(Schema)) { schemaService.validateUpdateSchema(readNode, mergedNode); }