Skip to content

Commit

Permalink
get contractor by id 2
Browse files Browse the repository at this point in the history
  • Loading branch information
asfi50 committed May 10, 2024
1 parent 5aa02c5 commit 2786f65
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions express-server/src/controllers/contractor.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ router.get('/contractor/:id', auth.required, async (req: Request, res: Response)
}
});

router.get('/contractor2/:id', auth.required, async (req: Request, res: Response) => {
try {
const contractor = await prisma.contractor.findUnique({
where: {
id: Number(req.params.id)
},
include: {
managers: true,
employees: true,
}
});
res.status(200).json(contractor);
} catch (error) {
res.status(400).json({ message: error.message });
}
});

// delete a contractor by id
router.delete('/contractor/:id', auth.required,auth.isSystemAdmin, async (req: Request, res: Response) => {
try {
Expand Down

0 comments on commit 2786f65

Please sign in to comment.