Skip to content
Snippets Groups Projects
Commit cf98661f authored by Samuli Virtapohja's avatar Samuli Virtapohja
Browse files

tracking folder audited

parent 9b724314
No related branches found
No related tags found
2 merge requests!59Development to master,!58Development to testing
import { IsNumber, Min, Max, Allow } from 'class-validator';
// latitude and longitude accepts degrees from worldmap
export class GeoDTO {
@IsNumber()
@Min(-90)
......
......@@ -42,14 +42,4 @@ export class TrackingController {
async getPlayerLocations(@GamePerson() gameperson, @Param('id') gameId) {
return this.trackingservice.getPlayers(gameperson, gameId);
}
// finds certain player
@Get('player/:id')
@Roles('admin', 'factionleader')
@GameStates('STARTED', 'PAUSED')
@UseInterceptors(ClassSerializerInterceptor)
async getPlayerData(@User('id') userId, @Param('id') gameid, @Body() person) {
return this.trackingservice.getPlayerData(person);
}
}
import { Allow, ValidateNested } from 'class-validator';
import { ValidateNested } from 'class-validator';
import { GeoDTO } from './geo.dto';
import { Type } from 'class-transformer';
......
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
import { Game_PersonEntity, GameEntity } from '../game/game.entity';
import { FactionEntity } from 'src/faction/faction.entity';
import { FactionEntity } from '../faction/faction.entity';
import { GeoDTO } from './geo.dto';
@Entity('Tracking')
......
......@@ -42,7 +42,6 @@ export class TrackingService {
await this.trackingrepository.save(trackedperson);
return { message: 'Location updated!' };
} else {
// first entry will be empty
trackdata['time'] = Date.now();
// initialize data
trackedperson = await this.trackingrepository.create(trackedperson);
......@@ -122,27 +121,4 @@ export class TrackingService {
);
return currentdata;
}
// get selected player data
async getPlayerData(person) {
const gameperson = await this.gamepersonrepository.findOne({
where: { gamepersonId: person.gamepersonId },
relations: ['person', 'leaderGroup', 'group', 'faction'],
});
if (!gameperson) {
throw new HttpException('No player found!', HttpStatus.BAD_REQUEST);
}
return {
gamepersonId: gameperson.gamepersonId,
name: gameperson.person.name,
role: gameperson.role,
group: gameperson.group,
faction: {
factionId: gameperson.faction.factionId,
factionName: gameperson.faction.factionName,
colour: gameperson.faction.colour,
},
};
}
}
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