From 799c981f404dc3d3cef0d59bc7a2a16f66a1f9c2 Mon Sep 17 00:00:00 2001 From: Abir Date: Wed, 14 Apr 2021 17:45:00 +0530 Subject: [PATCH 1/3] Standard Approach NestJS Fix --- src/assignment/assignment.controller.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/assignment/assignment.controller.ts b/src/assignment/assignment.controller.ts index 9d5a1d4..d801993 100644 --- a/src/assignment/assignment.controller.ts +++ b/src/assignment/assignment.controller.ts @@ -39,7 +39,7 @@ export class AssignmentController { @Post() @UsePipes(ValidationPipe) async addAssignment( - @Res() res, + @Res({ passthrough: true }) res, @Body() CreateAssignmentDTO: CreateAssignmentDTO, ) { const Assignment = await this.AssignmentService.addAssignment( @@ -54,7 +54,7 @@ export class AssignmentController { // Retrieve Assignments list @ApiCreatedResponse({ type: [AssignmentResponseBody] }) @Get() - async getAllAssignment(@Res() res) { + async getAllAssignment(@Res({ passthrough: true }) res) { const Assignments = await this.AssignmentService.getAllAssignment(); return res.status(HttpStatus.OK).json(Assignments); } @@ -62,14 +62,14 @@ export class AssignmentController { // Fetch a particular Assignment using ID @ApiCreatedResponse({ type: AssignmentResponseBody }) @Get('/:AssignmentId') - async getAssignment(@Res() res, @Param('AssignmentId') AssignmentId: string) { + async getAssignment(@Res({ passthrough: true }) res, @Param('AssignmentId') AssignmentId: string) { const Assignment = await this.AssignmentService.getAssignment(AssignmentId); return res.status(HttpStatus.OK).json(Assignment); } @Put('/update') async updateAssignment( - @Res() res, + @Res({ passthrough: true }) res, @Query('uid') uid, @Body() createAssignmentDTO: CreateAssignmentDTO, ) { @@ -89,7 +89,7 @@ export class AssignmentController { // Delete a Assignment @Delete('/delete') - async deleteAssignment(@Res() res, @Query('uid') uid) { + async deleteAssignment(@Res({ passthrough: true }) res, @Query('uid') uid) { const Assignment = await this.AssignmentService.deleteAssignment(uid); if (!Assignment) throw new NotFoundException('Assignment does not exist'); return res.status(HttpStatus.OK).json({ From 81e9673832e3353dd5a8bd3f838ef1925bd2efc9 Mon Sep 17 00:00:00 2001 From: Abir Date: Wed, 14 Apr 2021 20:48:03 +0530 Subject: [PATCH 2/3] Add Lint Fix --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7334360..fbbee03 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,4 +17,4 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 - name: install and then run linter - run: npm install eslint && npm run lint \ No newline at end of file + run: npm install eslint && npm run lint && npm run lint:fix From d7995b1e32da9e97cc0c7d4da7ca860dc9cbdf40 Mon Sep 17 00:00:00 2001 From: imabp Date: Thu, 15 Apr 2021 19:08:07 +0530 Subject: [PATCH 3/3] Removed Workflow Commit and Lint Fix --- .github/workflows/main.yml | 2 +- src/assignment/assignment.controller.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbbee03..8d3784d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,4 +17,4 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 - name: install and then run linter - run: npm install eslint && npm run lint && npm run lint:fix + run: npm install eslint && npm run lint diff --git a/src/assignment/assignment.controller.ts b/src/assignment/assignment.controller.ts index d801993..e3f3102 100644 --- a/src/assignment/assignment.controller.ts +++ b/src/assignment/assignment.controller.ts @@ -62,7 +62,10 @@ export class AssignmentController { // Fetch a particular Assignment using ID @ApiCreatedResponse({ type: AssignmentResponseBody }) @Get('/:AssignmentId') - async getAssignment(@Res({ passthrough: true }) res, @Param('AssignmentId') AssignmentId: string) { + async getAssignment( + @Res({ passthrough: true }) res, + @Param('AssignmentId') AssignmentId: string, + ) { const Assignment = await this.AssignmentService.getAssignment(AssignmentId); return res.status(HttpStatus.OK).json(Assignment); }