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

tasks wip

parent 12aa9a51
No related branches found
No related tags found
3 merge requests!59Development to master,!31Development,!23Faction tasks + Piirto
...@@ -78,7 +78,7 @@ export class GameService { ...@@ -78,7 +78,7 @@ export class GameService {
const gameId = await this.gameRepository.save(updatedGame); const gameId = await this.gameRepository.save(updatedGame);
// get all the factions that are associated with the game to deny duplicate entries // get all the factions that are associated with the game to deny duplicate entries
const factions = await this.factionRepository.find(gameId); const factions = await this.factionRepository.find({ game: gameId });
const factionNames = factions.map(({ factionName }) => factionName); const factionNames = factions.map(({ factionName }) => factionName);
// add the factions to db // add the factions to db
if (gameData.factions) { if (gameData.factions) {
......
...@@ -33,7 +33,7 @@ export class TaskController { ...@@ -33,7 +33,7 @@ export class TaskController {
// 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: TaskDTO) {
return this.taskService.newTask(task); return this.taskService.newTask(task);
......
import { IsString, Length, IsNumber, IsBoolean } from 'class-validator'; import {
IsString,
Length,
IsNumber,
IsBoolean,
Min,
Max,
} from 'class-validator';
import { FactionEntity } from 'src/game/faction.entity'; import { FactionEntity } from 'src/game/faction.entity';
export class TaskDTO { export class TaskDTO {
...@@ -9,7 +16,8 @@ export class TaskDTO { ...@@ -9,7 +16,8 @@ export class TaskDTO {
@Length(0, 255) @Length(0, 255)
taskDescription: string; taskDescription: string;
@IsNumber() @IsNumber()
@Length(1, 3) @Min(1)
@Max(99)
taskScore: number; taskScore: number;
@IsString() @IsString()
@Length(3, 31) @Length(3, 31)
......
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