Skip to content

Commit

Permalink
code - format
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin275 committed Oct 3, 2024
1 parent 5600504 commit f959453
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
13 changes: 5 additions & 8 deletions src/controller/credential_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export async function issueVC(req: express.Request, res: express.Response) {
const validationError = validateCredential(data);
if (validationError) {
return res.status(400).json({ error: validationError });
}
}

data = extractCredentialFields(data)
data = extractCredentialFields(data);

const schema = await dataSource
.getRepository(Schema)
Expand All @@ -49,7 +49,7 @@ export async function issueVC(req: express.Request, res: express.Response) {
schemaUri: schema?.identifier,
}
);

const vc: any = await Vc.addProof(
newCredContent,
async (data) => ({
Expand Down Expand Up @@ -106,9 +106,7 @@ export async function issueVC(req: express.Request, res: express.Response) {
console.log('Error: ', err);

return res.status(500).json({ error: 'Error in VD issuence' });
}


}

// TODO: If holder id is set vc will be sent to wallet

Expand Down Expand Up @@ -232,14 +230,13 @@ export async function updateCred(req: express.Request, res: express.Response) {
return res.status(200).json({
result: 'Updated successufully',
identifier: cred.identifier,
vc: updatedVc
vc: updatedVc,
});
}
return res.status(400).json({ error: 'Document not updated' });
} catch (error) {
console.log('error: ', error);
return res.status(500).json({ error: 'Error in updating document' });

}
}

Expand Down
11 changes: 4 additions & 7 deletions src/controller/schema_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,15 @@ export async function createSchema(

let data = req.body.schema?.schema || req.body.schema || null;


const validationError = validateSchema(data);
if (validationError) {
return res.status(400).json({ error: validationError });
}

data = extractSchemaFields(data)


}

data = extractSchemaFields(data);

let newSchemaName = data.title + ':' + Cord.Utils.UUID.generate();
data.title = newSchemaName;


let schemaDetails = await Cord.Schema.buildFromProperties(
data,
Expand Down

0 comments on commit f959453

Please sign in to comment.