From 730d9b0203a520d5e0cbac54617acfd220c75d17 Mon Sep 17 00:00:00 2001 From: vikastc Date: Wed, 20 Mar 2024 13:24:16 +0530 Subject: [PATCH] fix: schemaId changed from params to body Signed-off-by: vikastc --- src/controller/credential_controller.ts | 4 ++-- src/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controller/credential_controller.ts b/src/controller/credential_controller.ts index 0d610d1..a036f5a 100644 --- a/src/controller/credential_controller.ts +++ b/src/controller/credential_controller.ts @@ -28,7 +28,7 @@ export async function issueVC(req: express.Request, res: express.Response) { try { const schema = await getConnection() .getRepository(Schema) - .findOne({ identifier: req.params.id }); + .findOne({ identifier: data.schemaId }); const parsedSchema = JSON.parse(schema?.cordSchema as string); @@ -78,7 +78,7 @@ export async function issueVC(req: express.Request, res: express.Response) { console.log(`✅ Statement element registered - ${statement}`); const cred = new Cred(); - cred.schemaId = req.params.id; + cred.schemaId = data.schemaId; cred.identifier = vc.proof[1].identifier; cred.active = true; cred.fromDid = issuerDid.uri; diff --git a/src/index.ts b/src/index.ts index 37c5edd..ef7877c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,7 +24,7 @@ app.use(express.json()); const credentialRouter = express.Router({ mergeParams: true }); const schemaRouter = express.Router({ mergeParams: true }); -credentialRouter.post('/:id', async (req, res) => { +credentialRouter.post('/', async (req, res) => { return await issueVC(req, res); });