From a9027740095879e4c8df1bf9555f8968672623c5 Mon Sep 17 00:00:00 2001 From: vikastc Date: Thu, 24 Aug 2023 15:03:22 +0530 Subject: [PATCH] Formating Signed-off-by: vikastc --- src/controller/credential_controller.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/controller/credential_controller.ts b/src/controller/credential_controller.ts index b06abad..0606628 100644 --- a/src/controller/credential_controller.ts +++ b/src/controller/credential_controller.ts @@ -232,6 +232,8 @@ export async function updateCred(req: express.Request, res: express.Response) { let schemaProp: any = undefined; let credProp: any = undefined; + const updatedContent = data.property; + if (data.schemaId) { const schemaId = data.schemaId ? data.schemaId : ""; schemaProp = await getSchema(schemaId); @@ -247,13 +249,12 @@ export async function updateCred(req: express.Request, res: express.Response) { return res.status(400).json({ result: "No Cred found" }); } } - const keyUri = - `${issuerDid.uri}${issuerDid.authentication[0].id}` as Cord.DidResourceUri; + const schema = JSON.parse(schemaProp.cordSchema); const document = JSON.parse(credProp.credential); - const updatedContent = data.property; - const schema = JSON.parse(schemaProp.cordSchema); + const keyUri = + `${issuerDid.uri}${issuerDid.authentication[0].id}` as Cord.DidResourceUri; const updatedDocument: any = await updateStream( document, @@ -280,12 +281,10 @@ export async function updateCred(req: express.Request, res: express.Response) { await getConnection().manager.save(credProp); - return res - .status(200) - .json({ - result: "Updated successufully", - identifier: credProp.identifier, - }); + return res.status(200).json({ + result: "Updated successufully", + identifier: credProp.identifier, + }); } catch (error) { console.log("error: ", error); return res.status(400).json({ err: error });