From fac159c5cadff35f0e947501237d3de026ec2bd2 Mon Sep 17 00:00:00 2001 From: Gbuntu Date: Wed, 20 Sep 2023 20:59:01 +0330 Subject: [PATCH] need api added --- src/features/need/need.controller.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/features/need/need.controller.ts b/src/features/need/need.controller.ts index 2cdb57296..85bb4fb54 100644 --- a/src/features/need/need.controller.ts +++ b/src/features/need/need.controller.ts @@ -95,7 +95,16 @@ export class NeedController { } return await this.needService.getFlaskNeed(id); } - + @Get(`/:flaskId`) + @ApiOperation({ description: 'Get a need from db 2' }) + async getNeedByFlaskId(@Req() req: Request, @Param('flaskId') flaskId: number) { + const panelFlaskUserId = req.headers['panelFlaskUserId']; + const panelFlaskTypeId = req.headers['panelFlaskTypeId']; + if (!isAuthenticated(panelFlaskUserId, panelFlaskTypeId)) { + throw new ForbiddenException(401, 'You Are not authorized!'); + } + return await this.needService.getNeedByFlaskId(flaskId); + } @Get(`preneeds`) @ApiOperation({ description: 'Get all done needs from flask' }) async getPrNeed(@Req() req: Request) {