Skip to content
Snippets Groups Projects

Development to testing

Merged Ghost User requested to merge Development into testing
10 files
+ 89
56
Compare changes
  • Side-by-side
  • Inline
Files
10
@@ -7,8 +7,6 @@ import {
@@ -7,8 +7,6 @@ import {
Body,
Body,
Get,
Get,
Put,
Put,
UseInterceptors,
ClassSerializerInterceptor,
Delete,
Delete,
} from '@nestjs/common';
} from '@nestjs/common';
@@ -26,6 +24,23 @@ import { FactionService } from './faction.service';
@@ -26,6 +24,23 @@ import { FactionService } from './faction.service';
import { Roles, GameStates } from '../shared/guard.decorator';
import { Roles, GameStates } from '../shared/guard.decorator';
import { GamePerson } from 'src/game/gameperson.decorator';
import { GamePerson } from 'src/game/gameperson.decorator';
 
/*
 
FactionController is being used for routing:
 
 
Group
 
- create group when game status is CREATED
 
- getting groups with faction id(this is used mainly for listing players)
 
- joining group when game status is CREATED
 
 
Faction
 
- checking users faction
 
- joining faction
 
- leaving faction
 
- changing faction multiplier (not implemented)
 
 
See shared folder files for more information on decorators.
 
*/
 
@Controller('faction')
@Controller('faction')
export class FactionController {
export class FactionController {
constructor(private factionservice: FactionService) {}
constructor(private factionservice: FactionService) {}
@@ -40,9 +55,7 @@ export class FactionController {
@@ -40,9 +55,7 @@ export class FactionController {
@Param('id') id: string,
@Param('id') id: string,
@Body() data: GameGroupDTO,
@Body() data: GameGroupDTO,
) {
) {
try {
return this.factionservice.createGroup(person, id, data);
return this.factionservice.createGroup(person, id, data);
} catch (error) {}
}
}
// id is faction ID
// id is faction ID
@@ -63,12 +76,6 @@ export class FactionController {
@@ -63,12 +76,6 @@ export class FactionController {
return this.factionservice.joinGroup(gameperson, data);
return this.factionservice.joinGroup(gameperson, data);
}
}
@UseInterceptors(ClassSerializerInterceptor)
@Get('get-faction-members/:id')
async getFactionMembers(@Param('id') factionId) {
return this.factionservice.listFactionMembers(factionId);
}
// param game ID is passed to @Roles
// param game ID is passed to @Roles
@Put('promote/:id')
@Put('promote/:id')
@Roles('admin')
@Roles('admin')
@@ -100,13 +107,15 @@ export class FactionController {
@@ -100,13 +107,15 @@ export class FactionController {
leaveFaction(@GamePerson('gamepersonId') gamepersonId) {
leaveFaction(@GamePerson('gamepersonId') gamepersonId) {
return this.factionservice.leaveFaction(gamepersonId);
return this.factionservice.leaveFaction(gamepersonId);
}
}
 
// used to change factions multiplier
// used to change factions multiplier
@Put('faction-multiplier/:id')
// not implemented in frontend uncomment this and services equivalent when needed
@Roles('admin')
// @Put('faction-multiplier/:id')
@GameStates('STARTED')
// @Roles('admin')
factionMultiplier(@Param('id') game, @Body() body: FactionDTO) {
// @GameStates('STARTED')
return this.factionservice.changeFactionMultiplier(body);
// factionMultiplier(@Param('id') game, @Body() body: FactionDTO) {
}
// return this.factionservice.changeFactionMultiplier(body);
 
// }
// check if person belongs to a faction in a game
// check if person belongs to a faction in a game
@Get('check-faction/:id')
@Get('check-faction/:id')
Loading