Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard Approach NestJS Fix #52

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
run: npm install eslint && npm run lint
13 changes: 8 additions & 5 deletions src/assignment/assignment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -54,22 +54,25 @@ 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);
}

// 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,
) {
Expand All @@ -89,7 +92,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({
Expand Down