Skip to content
Snippets Groups Projects
Commit 631e4935 authored by L4721's avatar L4721
Browse files

Merge branch 'Development' into 'JoinGame'

# Conflicts:
#   src/game/coordinate.entity.ts
#   src/game/faction.entity.ts
#   src/game/game.controller.ts
#   src/game/game.dto.ts
#   src/game/game.entity.ts
#   src/game/game.module.ts
#   src/game/game.service.ts
#   src/user/user.entity.ts
#   src/user/user.module.ts
parents 4616442a cab7ecb0
No related branches found
No related tags found
2 merge requests!59Development to master,!18Join game
import {
IsString,
IsDateString,
IsJSON,
IsNotEmpty,
IsString,
IsDate,
Length,
IsInt,
Min,
Max,
IsArray,
Validate,
IsJSON,
} from 'class-validator';
import { ArrayLength } from 'src/shared/array-validation';
import { Timestamp } from 'typeorm';
export class GameDTO {
// uses class-validator built in validations
// see https://github.com/typestack/class-validator
@IsString()
@IsNotEmpty()
@Length(2, 31)
@Length(3, 30)
name: string;
@IsString()
gameDescription?: string;
@IsDate()
@IsNotEmpty()
@Length(1, 255)
desc: string;
......@@ -36,6 +40,14 @@ export class GameDTO {
// custom validation for array length (arr>min, arr<max)
//@Validate(ArrayLength, [4, 8])
factions?: FactionDTO[];
@IsArray()
@IsNotEmpty()
objectivePoint?: ObjectivePointDTO[];
@IsJSON()
@IsNotEmpty()
mapCoordinates: JSON;
}
export class FactionDTO {
......
......@@ -11,6 +11,6 @@ import { FactionEntity } from './faction.entity';
@Module({
imports: [TypeOrmModule.forFeature([GameEntity, FactionEntity, Game_PersonEntity, PersonEntity, GameGroupEntity])],
controllers: [GameController],
providers: [GameService]
providers: [GameService],
})
export class GameModule {}
......@@ -92,6 +92,14 @@ export class GameService {
};
}
async deleteGame(id) {
// TODO: Delete factions from Faction table associated with the deleted game
await this.gameRepository.delete({ id });
return {
message: 'Game deleted',
};
}
// checks the password, creates an entry in GamePerson table with associated role&faction
async createGroup(person, gameId, groupData) {
try {
......
......@@ -7,9 +7,9 @@ import {
} from 'typeorm';
import * as bcrypt from 'bcryptjs';
import * as jwt from 'jsonwebtoken';
import { MapMarkerEntity } from '../mapmarkers/mapmarker.entity';
import { Game_PersonEntity } from '../game/game.entity';
import { MapMarkerEntity } from 'src/mapmarkers/mapmarker.entity';
import {TaskEntity} from '../game/faction.entity'
import {Game_PersonEntity} from '../game/game.entity'
@Entity('Person')
export class PersonEntity {
......
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