-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from cdalton713/backend
Backend: fully implemented assign endpoints
- Loading branch information
Showing
17 changed files
with
304 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Body, Controller, Get, Param, Post } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { AssignmentService } from './assignment.service'; | ||
import { AssignmentType } from './dto/assignment.dto'; | ||
import { CreateAssignmentDTO } from './dto/create-assignment.dto'; | ||
|
||
@ApiTags('assignment') | ||
@Controller('/api/assign') | ||
export class AssignmentController { | ||
constructor(private readonly ticketAssignService: AssignmentService) {} | ||
|
||
/* WORKING Implementation */ | ||
/* TODO: fix date formatting */ | ||
@Post() | ||
async create(@Body() createAssignmentDTO: CreateAssignmentDTO) { | ||
return await this.ticketAssignService.create(createAssignmentDTO); | ||
} | ||
|
||
/* WORKING Implementation */ | ||
@Get() | ||
findAll() { | ||
return this.ticketAssignService.findAll(); | ||
} | ||
|
||
/* WORKING Implementation */ | ||
@Get('user/:lsu_id') | ||
findAllByLsuId(@Param('lsu_id') lsu_id: number) { | ||
return this.ticketAssignService.findAllById(AssignmentType.LSU_ID, lsu_id); | ||
} | ||
|
||
/* WORKING Implementation */ | ||
@Get('ticket/:ticket_id') | ||
findAllByTicketId(@Param('ticket_id') ticket_id: number) { | ||
return this.ticketAssignService.findAllById( | ||
AssignmentType.TICKET_ID, | ||
ticket_id, | ||
); | ||
} | ||
|
||
/* WORKING Implementation */ | ||
@Get(':assignment_id') | ||
findOne(@Param('assignment_id') assignment_id: string) { | ||
return this.ticketAssignService.findOne(+assignment_id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AssignmentService } from './assignment.service'; | ||
import { AssignmentController } from './assignment.controller'; | ||
import { DbModule } from 'src/db/db.module'; | ||
|
||
@Module({ | ||
imports: [DbModule], | ||
controllers: [AssignmentController], | ||
providers: [AssignmentService], | ||
}) | ||
export class AssignmentModule {} |
Oops, something went wrong.