|
|
|
## FACTION
|
|
|
|
|
|
|
|
Tracking-folder follows the usual logic containing a controller, a service, a DTO and an entity file.
|
|
|
|
|
|
|
|
## tracking.controller.ts
|
|
|
|
|
|
|
|
Contains two routes, which are all prefixed with url `tracking`.
|
|
|
|
|
|
|
|
### insert tracking data, POST /tracking/location/{game's UUID}
|
|
|
|
|
|
|
|
- Body must contain a GeoDTO JSON-object as specified in [`tracking.dto.ts`](./dtos#geodto):
|
|
|
|
|
|
|
|
- Must be sent with authorization header containing a Bearer token
|
|
|
|
|
|
|
|
- GameState must be in `STARTED` for the request to pass
|
|
|
|
|
|
|
|
- User's gameperson role must be `soldier`
|
|
|
|
|
|
|
|
### get player locations, GET /tracking/players/{game's UUID}
|
|
|
|
|
|
|
|
- Must be sent with authorization header containing a Bearer token
|
|
|
|
|
|
|
|
- GameState must be in `STARTED` or `PAUSED` state for the request to pass
|
|
|
|
|
|
|
|
- User's gameperson role must be `admin` or `factionleader`
|
|
|
|
|
|
|
|
## draw.service.ts
|
|
|
|
|
|
|
|
Contains two functions and an object switch for icons
|
|
|
|
|
|
|
|
### tracklocation(data: [GeoDTO](./dtos#geodto))
|
|
|
|
|
|
|
|
- Creates a new tracking entry for the gameperson if one does not exist
|
|
|
|
|
|
|
|
- Adds an icon based on player's group
|
|
|
|
|
|
|
|
- Adds an reference to the player's faction
|
|
|
|
|
|
|
|
- If a row already exists, push new tracking data to the `data` field
|
|
|
|
|
|
|
|
### getPlayers(data: gameperson, gameId)
|
|
|
|
|
|
|
|
- Creates an array for each faction the person has permission to see
|
|
|
|
|
|
|
|
- Admin sees all players, factionleader see only their own players
|
|
|
|
|
|
|
|
- Inside the faction, it creates an array for each group that the faction has
|
|
|
|
|
|
|
|
- Inside the groups, it pushes the players to their respective group
|
|
|
|
|
|
|
|
## tracking.entity.ts
|
|
|
|
|
|
|
|
Reflects the datababse table for tracking data |