Fix tests by adding json analysis

pull/32/head
HardiReady 2018-04-01 10:59:09 +02:00
parent 74b1b587a6
commit 01b2378d6d
11 changed files with 141 additions and 946 deletions

View File

@ -0,0 +1,79 @@
# Log (object)
## Properties
+ _id: `` (string, required) - log entry id
+ war: `` (string, required) - warId
+ time: `` (string, required) - logging timestamp
+ __v: 0 (number, required) - object version number
# LogPoints (Log)
## Properties
+ ptBlufor: 2 (number, required) -
+ ptOpfor: 4 (number, required) -
+ fraction: `OPFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
+ `NONE`
#LogBudget (Log)
## Properties
+ oldBudget: 400000 (number, required)
+ newBudget: 380000 (number, required)
+ fraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
#LogFlag (Log)
## Properties
+ player: `HardiReady` (string, required)
+ capture: true (boolean, required)
+ flagFraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
#LogKill (Log)
## Properties
+ shooter: `HardiReady` (string, required)
+ target: `KalleK` (string, required)
+ friendlyFire: true (boolean, required)
+ fraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
+ `NONE`
#LogRespawn (Log)
## Properties
+ player: `radical1976` (string, required)
#LogRevive (Log)
## Properties
+ medic: `radical1976` (string, required)
+ patient: `radical1976` (string, required)
+ stabilized: false (boolean, required)
+ flagFraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
#LogTransport (Log)
## Properties
+ driver: `radical1976` (string, required)
+ passenger: `radical1976` (string, required)
+ distance: 2435 (number, required)
+ flagFraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
#LogVehicle (Log)
## Properties
+ shooter: `HardiReady` (string, required)
+ target: `Murda]X[` (string, required)
+ fraction: `BLUFOR` (enum, required)
+ Members
+ `BLUFOR`
+ `OPFOR`
+ `NONE`

View File

@ -14,7 +14,7 @@ Basic player statistic information object
+ revive: 0 (number, required) - sum of revives + revive: 0 (number, required) - sum of revives
# CampaignPlayer (BasicPlayer) # WarPlayer (BasicPlayer)
A player campaign statistics object A player campaign statistics object
## Properties ## Properties

View File

@ -14,7 +14,8 @@ A war as used in statistics
+ budgetBlufor: 3900000 (number, required) - start budget of fraction Blufor + budgetBlufor: 3900000 (number, required) - start budget of fraction Blufor
+ budgetOpfor: 4100000 (number, required) - start budget of fraction Opfor + budgetOpfor: 4100000 (number, required) - start budget of fraction Opfor
+ endBudgetBlufor: 924000 (number, required) - end budget of fraction Blufor + endBudgetBlufor: 924000 (number, required) - end budget of fraction Blufor
+ endBudgetOpfor: -12400 (number, required) - end budget of fraction Opfor + endBudgetOpfor: 12400 (number, required) - end budget of fraction Opfor
+ players (array[WarPlayer], required) - collection of all participating players with their statistics
+ timestamp: `2018-02-24T01:01:25.825Z` (string, required) - creation date + timestamp: `2018-02-24T01:01:25.825Z` (string, required) - creation date
+ updatedAt: `2018-02-24T01:01:25.825Z` (string, required) - the version timestamp + updatedAt: `2018-02-24T01:01:25.825Z` (string, required) - the version timestamp
+ __v: 0 (number, required) - the version number of the object + __v: 0 (number, required) - the version number of the object

View File

@ -12,6 +12,8 @@
:[Gists](_decoration.apib) :[Gists](_decoration.apib)
:[Gists](_log.apib)
:[Gists](_player.apib) :[Gists](_player.apib)
:[Gists](_promotion.apib) :[Gists](_promotion.apib)

View File

@ -40,6 +40,8 @@ FORMAT: 1A
# Group Logs # Group Logs
:[Gists](statistics/logs.apib)
# Group Players # Group Players
:[Gists](statistics/players.apib) :[Gists](statistics/players.apib)

View File

@ -0,0 +1,18 @@
### Get War Logs [GET /logs/{warId}]
Ge the combined log object, containing all events in collections, for a single war
+ Parameters
+ warId: `5abf65ae3fc5fa349ffd5ca3` (string, required) - unique id of the war
+ Response 200 (application/json; charset=utf-8)
+ Attributes
+ points (array[LogPoints], required)
+ budget (array[LogBudget], required)
+ respawn (array[LogRespawn], required)
+ revive (array[LogRevive], required)
+ kill (array[LogKill], required)
+ vehicle (array[LogVehicle], required)
+ transport (array[LogTransport], required)
+ flag (array[LogFlag], required)

View File

@ -1,4 +1,4 @@
### Get Player Highscore [GET /ranking/{campaignId}] ### Get Player Highscore [GET /players/ranking/{campaignId}]
List highscores for player statistics over all wars of a certain campaign. List highscores for player statistics over all wars of a certain campaign.
Every highscore player object contains a field *sum*, representing its order number in the collection Every highscore player object contains a field *sum*, representing its order number in the collection
@ -6,7 +6,7 @@ Every highscore player object contains a field *sum*, representing its order num
+ Parameters + Parameters
+ campaignId: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign + campaignId: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes + Attributes
+ kill (array[HighscorePlayer],required) - player highscore for kill + kill (array[HighscorePlayer],required) - player highscore for kill
@ -18,17 +18,17 @@ Every highscore player object contains a field *sum*, representing its order num
+ flagTouch (array[HighscorePlayer],required) - player highscore for flag captures + flagTouch (array[HighscorePlayer],required) - player highscore for flag captures
### Get Player Campaign Statistics [GET /single/{campaignId}/{playerId}] ### Get Player Campaign Statistics [GET /players/single/{campaignId}/{playerSteamId}]
Get statistics for a single player for all wars of a campaign he took part at Get statistics for a single player for all wars of a campaign he took part at
+ Parameters + Parameters
+ campaignId: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign + campaignId: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign
+ playerId: `5abf65ae3fc5fa349ffd5ca4` (string, required) - unique id of the player + playerSteamId: `76561198050321490` (string, required) - STEAM application unique user id of player
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes + Attributes
+ name: `Pumarang` (string, required) - latest used playername + name: `Pumarang` (string, required) - latest used playername
+ campaign (Campaign,required) - campaign reflected from request is + campaign (Campaign,required) - campaign reflected from request is
+ players (array[CampaignPlayer],required) - collection of player instances in the campaign + players (array[WarPlayer],required) - collection of player instances in the campaign

View File

@ -13,7 +13,7 @@ Retrieve single war data
+ Parameters + Parameters
+ id: `5abf65ae3fc5fa349ffd5ca3` (string, required) - unique id of the war to fetch + id: `5abf65ae3fc5fa349ffd5ca3` (string, required) - unique id of the war to fetch
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (War, fixed-type) + Attributes (War, fixed-type)

960
api/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
"aglio": "^2.3.0", "aglio": "^2.3.0",
"chai": "^3.5.0", "chai": "^3.5.0",
"chai-http": "^3.0.0", "chai-http": "^3.0.0",
"dredd": "^5.1.4", "dredd": "^5.1.5",
"eslint": "^4.18.2", "eslint": "^4.18.2",
"eslint-config-google": "^0.9.1", "eslint-config-google": "^0.9.1",
"hercule": "^4.1.1", "hercule": "^4.1.1",

View File

@ -58,11 +58,10 @@ logsRouter.route('/:warId')
async.parallel(resources, (error, results) => { async.parallel(resources, (error, results) => {
if (error) { if (error) {
res.status(500).send(error); res.status(500);
return;
} }
res.locals.items = results; res.locals.items = results;
next(); next(error);
}); });
}) })
.all( .all(