Skip to content
Snippets Groups Projects

Dto service

Merged Ghost User requested to merge dto-service into piirto2
1 file
+ 12
17
Compare changes
  • Side-by-side
  • Inline
+ 12
17
@@ -10,32 +10,27 @@ import {
@@ -10,32 +10,27 @@ import {
import { TaskService } from './task.service';
import { TaskService } from './task.service';
import { Roles } from '../shared/roles.decorator';
import { Roles } from '../shared/roles.decorator';
import { ValidationPipe } from '../shared/validation.pipe';
import { ValidationPipe } from '../shared/validation.pipe';
import { TaskDTO } from './task.dto';
import { CreateTaskDTO, EditTaskDTO } from './task.dto';
@Controller('task')
@Controller('task')
export class TaskController {
export class TaskController {
constructor(private taskService: TaskService) {}
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
// creates a new task if the user has admin role in the game
// :id is the id of the game
// :id is the id of the game
@Post('new-task/:id')
@Post('new-task/:id')
//@Roles('admin')
@Roles('admin')
@UsePipes(new ValidationPipe())
@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);
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);
 
}
}
}
Loading