Skip to content

Commit

Permalink
added issuer detail to getServiceById
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMohit2003 committed Feb 23, 2024
1 parent 3b1b9b0 commit e15ba2e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controllers/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,23 @@ const getServiceById = async (req, res) => {
const service = await prisma.service.findUnique({
where: { id },
});
const issuer = await prisma.issuer.findUnique({
where: { id: service.issuerId },
});

if (!service) {
return res.status(404).json({
message: 'Service not found',
});
}
if (!issuer) {
return res.status(404).json({
message: 'Issuer not found',
});
}

service.issuer = issuer;

res.status(200).json({
service,
});
Expand Down

0 comments on commit e15ba2e

Please sign in to comment.