Skip to content
Snippets Groups Projects
Commit 39da24f7 authored by L4168's avatar L4168
Browse files

added route for edit-task

parent 29305d75
No related branches found
No related tags found
4 merge requests!59Development to master,!31Development,!25Dto service,!24Faction task edit
......@@ -10,32 +10,27 @@ import {
import { TaskService } from './task.service';
import { Roles } from '../shared/roles.decorator';
import { ValidationPipe } from '../shared/validation.pipe';
import { TaskDTO } from './task.dto';
import { CreateTaskDTO, EditTaskDTO } from './task.dto';
@Controller('task')
export class TaskController {
constructor(private taskService: TaskService) {}
/* @Post('new')
@UseGuards(new AuthGuard())
@UsePipes(new ValidationPipe())
async newGame(@User('id') person, @Body() body: GameDTO) {
return this.gameservice.createNewGame(person, body);
}
@Put(':id')
@Roles('admin')
@UsePipes(new ValidationPipe())
async editGame(@Param('id') id: string, @Body() body: GameDTO) {
return this.gameservice.editGame(id, body);
} */
// creates a new task if the user has admin role in the game
// :id is the id of the game
@Post('new-task/:id')
//@Roles('admin')
@Roles('admin')
@UsePipes(new ValidationPipe())
async newTask(@Param('id') id: string, @Body() task: TaskDTO) {
async newTask(@Param('id') id: string, @Body() task: CreateTaskDTO) {
return this.taskService.newTask(task);
}
// edits a created task if the user has admin role in the game
// :id is the id of the game
@Post('edit-task/:id')
@Roles('admin')
@UsePipes(new ValidationPipe())
async editTask(@Param('id') id: string, @Body() data: EditTaskDTO) {
return this.taskService.editTask(data);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment