Fix apib tests

pull/32/head
HardiReady 2018-04-01 15:12:24 +02:00
parent 01b2378d6d
commit 14b3d7c4ee
19 changed files with 107 additions and 64 deletions

View File

@ -1,7 +1,7 @@
### GET Army Overview [GET /overview] ### Get Army Overview [GET /overview]
Get bundled army, squad and member data for the participating fractions Get bundled army, squad and member data for the participating fractions
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (ArmyOverview) + Attributes (ArmyOverview)

View File

@ -20,9 +20,9 @@ List all awardings
+ `GLOBAL` + `GLOBAL`
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[Awarding], fixed-type) + Attributes (array[AwardingPopulated], fixed-type)
### Create Awarding [POST /awardings] ### Create Awarding [POST /awardings]
@ -38,7 +38,7 @@ Create a new awarding which is immediatly assigned to the user
+ reason: `Good boy` (string, required) - reason for giving the awarding + reason: `Good boy` (string, required) - reason for giving the awarding
+ proposer: `5ab68ceef547ed304064e5f6` (string, required) - app user id, who requested this awarding + proposer: `5ab68ceef547ed304064e5f6` (string, required) - app user id, who requested this awarding
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Awarding, fixed-type) + Attributes (Awarding, fixed-type)
@ -55,6 +55,6 @@ Create a new awarding proposal, that needs to be approved by higher permission l
+ decorationId: `5abd3dff6e6a0334d95b8ba0` (string, required) - unique id of the decoration + decorationId: `5abd3dff6e6a0334d95b8ba0` (string, required) - unique id of the decoration
+ reason: `Good boy` (string, required) - reason for giving the awarding + reason: `Good boy` (string, required) - reason for giving the awarding
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Awarding, fixed-type) + Attributes (Awarding, fixed-type)

View File

@ -1,4 +1,4 @@
### GET Decorations [GET /decorations{?q,fractFilter}] ### List Decorations [GET /decorations{?q,fractFilter}]
List all decorations List all decorations
@ -14,19 +14,19 @@ List all decorations
+ `OPFOR` + `OPFOR`
+ `GLOBAL` + `GLOBAL`
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[Decoration], fixed-type) + Attributes (array[Decoration], fixed-type)
### GET Decoration [GET /decorations/{id}] ### Get Decoration [GET /decorations/{id}]
Retrieve single decoration data Retrieve single decoration data
+ Parameters + Parameters
+ id: `5abd3dff6e6a0334d95b8ba0` (string, required) - unique id of the decoration to fetch + id: `5abd3dff6e6a0334d95b8ba0` (string, required) - unique id of the decoration to fetch
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Decoration, fixed-type) + Attributes (Decoration, fixed-type)
@ -65,7 +65,7 @@ Create a new decoration
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Decoration, fixed-type) + Attributes (Decoration, fixed-type)
@ -107,7 +107,7 @@ Update decoration, identified by its id
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Decoration, fixed-type) + Attributes (Decoration, fixed-type)

View File

@ -1,4 +1,4 @@
### GET Promotions [GET /promotion{?squadId,inProgress,fractFilter}] ### List Promotions [GET /request/promotion{?squadId,inProgress,fractFilter}]
List all promotion requests List all promotion requests
@ -19,9 +19,9 @@ List all promotion requests
+ `OPFOR` + `OPFOR`
+ `GLOBAL` + `GLOBAL`
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[Promotion]) + Attributes (array[PromotionPopulated])
### Create Promotion Proposal [POST /request/promotion] ### Create Promotion Proposal [POST /request/promotion]
@ -36,7 +36,7 @@ Create a new proposal for a promotion, that needs to be approved by higher permi
+ oldRankLvl: 0 (number, required) - previous rank level + oldRankLvl: 0 (number, required) - previous rank level
+ newRankLvl: 5 (number, required) - new rank level to apply + newRankLvl: 5 (number, required) - new rank level to apply
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Promotion, fixed-type) + Attributes (Promotion, fixed-type)
@ -60,6 +60,6 @@ Update the promotion proposal
+ newRankLvl: 5 (number, optional) - new rank level to apply + newRankLvl: 5 (number, optional) - new rank level to apply
+ confirmed: 1 (number, optional) confirmation status of the promotion (0 - in progress, 1 - approved & applied, 2 - rejected) \nThis automatically applies the *newRankLvl*value as new rank level to the target user when confirmed = 1 + confirmed: 1 (number, optional) confirmation status of the promotion (0 - in progress, 1 - approved & applied, 2 - rejected) \nThis automatically applies the *newRankLvl*value as new rank level to the target user when confirmed = 1
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Promotion, fixed-type) + Attributes (Promotion, fixed-type)

View File

@ -1,4 +1,4 @@
### GET Ranks [GET /ranks{?q,fractFilter}] ### List Ranks [GET /ranks{?q,fractFilter}]
List all ranks List all ranks
@ -13,19 +13,19 @@ List all ranks
+ `OPFOR` + `OPFOR`
+ `GLOBAL` + `GLOBAL`
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[Rank], fixed-type) + Attributes (array[Rank], fixed-type)
### GET Rank [GET /ranks/{id}] ### Get Rank [GET /ranks/{id}]
Retrieve single rank data Retrieve single rank data
+ Parameters + Parameters
+ id: `5aba5504eadcce6332c6a775` (string, required) - unique id of the rank to fetch + id: `5aba5504eadcce6332c6a775` (string, required) - unique id of the rank to fetch
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Rank, fixed-type) + Attributes (Rank, fixed-type)
@ -59,7 +59,7 @@ Create a new rank
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Rank, fixed-type) + Attributes (Rank, fixed-type)
@ -96,7 +96,7 @@ Update rank, identified by its id
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Rank, fixed-type) + Attributes (Rank, fixed-type)

View File

@ -1,4 +1,4 @@
### Get Squads [GET /squads{?q,fractFilter}] ### List Squads [GET /squads{?q,fractFilter}]
Get single army member information Get single army member information
@ -13,7 +13,7 @@ Get single army member information
+ `OPFOR` + `OPFOR`
+ `GLOBAL` + `GLOBAL`
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[Squad], fixed-type) + Attributes (array[Squad], fixed-type)
@ -24,7 +24,7 @@ Get single squad information
+ Parameters + Parameters
+ id: `5aba54eaeadcce6332c6a774` (string, required) - unique id of the squad + id: `5aba54eaeadcce6332c6a774` (string, required) - unique id of the squad
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Squad, fixed-type) + Attributes (Squad, fixed-type)
@ -53,7 +53,7 @@ Create a new squad
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Squad, fixed-type) + Attributes (Squad, fixed-type)
@ -90,7 +90,7 @@ Update squad, identified by its id
QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII=
-----BOUNDARY-- -----BOUNDARY--
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Squad, fixed-type) + Attributes (Squad, fixed-type)

View File

@ -1,4 +1,4 @@
### Get Users [GET /users{?q,fractFilter,limit,offset}] ### List Users [GET /users{?q,fractFilter,limit,offset}]
Get single army member information Get single army member information
@ -23,13 +23,13 @@ Get single army member information
+ Default: 0 + Default: 0
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Headers + Headers
X-Total-Count: 1 X-Total-Count: 1
+ Attributes (array[User], fixed-type) + Attributes (array[UserPopulated], fixed-type)
### Get User [GET /users/{id}] ### Get User [GET /users/{id}]
@ -39,9 +39,9 @@ Get single army member information
+ Parameters + Parameters
+ id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of army-member + id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of army-member
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (User, fixed-type) + Attributes (UserPopulated, fixed-type)
### Create User [POST /users] ### Create User [POST /users]
@ -53,9 +53,9 @@ Create a new army member
+ Attributes + Attributes
+ username: `[GNC]Paolo` (string, required) - display name of the user + username: `[GNC]Paolo` (string, required) - display name of the user
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (User, fixed-type) + Attributes (UserInclTimestamp, fixed-type)
### Update User [PUT /users/{id}] ### Update User [PUT /users/{id}]
@ -72,7 +72,7 @@ Update an army member, identified by its id
+ rankLvl: 22 (number, optional) - rank level representing the rank + rankLvl: 22 (number, optional) - rank level representing the rank
+ squadId: `591470249e9fae286e008e31` (string, optional) - squadId of squad which army member is part of + squadId: `591470249e9fae286e008e31` (string, optional) - squadId of squad which army member is part of
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (User, fixed-type) + Attributes (User, fixed-type)

View File

@ -6,6 +6,6 @@ Generate a token which can be used to make API requests.
+ Attributes (Login) + Attributes (Login)
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (LoginResponse) + Attributes (LoginResponse)

View File

@ -6,4 +6,8 @@ Create a new application user account.
+ Attributes (Registration) + Attributes (Registration)
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes
+ message: `User successfully created` (string, required)

View File

@ -13,9 +13,9 @@ Response object on successful token creation
+ _id: `593d632772d35225232bcabb` (string, required) - the unique id of the app-user + _id: `593d632772d35225232bcabb` (string, required) - the unique id of the app-user
+ username: `kallek` (string, required) - the username of the app-user + username: `kallek` (string, required) - the username of the app-user
+ permission: 3 - the permission level of the app-user (0 - user, 1 - sql, 2 - hl, 3 - maintainer, 4 - admin) + permission: 3 (number, required)- the permission level of the app-user (0 - user, 1 - sql, 2 - hl, 3 - maintainer, 4 - admin)
+ squad (Squad, required) - squad the app-user is member of + squad (Squad, required) - squad the app-user is member of
+ token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1OTNkNWUzZjcyZDM1MjI1MjIyYmNhYmEiLCJpYXQiOjE1MjEzOTQ5NDYsImV4cCI6MTUyMzgxNDE0Nn0.vOAwA5--qrx8BglhyGZWVYx7LeuRKOHH0NQXmHFNhIQ` (string,required) - generated token + token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1OTNkNWUzZjcyZDM1MjI1MjIyYmNhYmEiLCJpYXQiOjE1MjEzOTQ5NDYsImV4cCI6MTUyMzgxNDE0Nn0.vOAwA5--qrx8BglhyGZWVYx7LeuRKOHH0NQXmHFNhIQ` (string,required) - generated access token
+ tokenExpireDate: `2018-04-15T17:42:25.050Z` (string,required) - expiration date of the token + tokenExpireDate: `2018-04-15T17:42:25.050Z` (string,required) - expiration date of the token

View File

@ -2,13 +2,21 @@
Awarding associating a decoration to a user Awarding associating a decoration to a user
## Properties ## Properties
+ _id:`591ca81c1ee62711cfc19002` (string, required) - unique id of the awarding + _id: `591ca81c1ee62711cfc19002` (string, required) - unique id of the awarding
+ confirmed: 1 (number, required) - status of the awarding request (0 - in progress, 1 - approved, 2 - rejected) + confirmed: 1 (number, required) - status of the awarding request (0 - in progress, 1 - approved, 2 - rejected)
+ date: `2017-05-17T19:44:24.926Z` (string, required) - date when the awarding was requested + date: `2017-05-17T19:44:24.926Z` (string, required) - date when the awarding was requested
+ decorationId (Decoration, required) - populated decoration object that is given with the awarding + decorationId: `591c81981ee62711cfc18f4a` (string, required) - id of decoration that is given with the awarding
+ reason: `war dabei` (string, required) - reason for giving the awarding + reason: `war dabei` (string, required) - reason for giving the awarding
+ proposer (Proposer, required) - app user who requested this awarding, null if awarding was given directly + proposer: 593d5e3f72d35225222bcaba (string, required) - id of app user who requested this awarding
+ timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date + timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date
+ updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date + updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date
+ userId: `5918d2ca574b0b1d820a0b24` (string, required) - the unique id of the user who got this awarding + userId: `5918d2ca574b0b1d820a0b24` (string, required) - the unique id of the user who got this awarding
+ __v: 0 (number, required) - version number + __v: 0 (number, required) - version number
# AwardingPopulated (Awarding)
Awarding with populated decoration and proposer
## Properties
+ proposer (Proposer, required) - app user who requested this awarding
+ decorationId (Decoration, required) - populated decoration object that is given with the awarding

View File

@ -7,3 +7,10 @@ Campaign entity
+ timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date + timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date
+ updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date + updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date
+ __v: 0 (number, required) - version number + __v: 0 (number, required) - version number
#WarCampaign (object)
Cmpaign entity with attached War collection
## Properties
+ _id: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of the campaign
+ title: `Ein Kessel Buntes` (string, required) - display title of the campaign
+ wars (array[WarWithPlayers], requied)

View File

@ -4,10 +4,17 @@ Representation of a promotion request for a army member
## Properties ## Properties
+ _id: `5as7d05dcb90ce4da68c4f5f` (string, required) - unique id of the promotion request + _id: `5as7d05dcb90ce4da68c4f5f` (string, required) - unique id of the promotion request
+ confirmed: 0 (number, required) - number representing status of the promotion (0 - in progress, 1 - approved, 2 - rejected) + confirmed: 0 (number, required) - number representing status of the promotion (0 - in progress, 1 - approved, 2 - rejected)
+ newRankLvl: 14 - new rank level that is requested in this promotion + newRankLvl: 14 (number, required)- new rank level that is requested in this promotion
+ oldRankLvl: 10 - old rank level of the user + oldRankLvl: 10 (number, required)- old rank level of the user
+ proposer (Proposer, required) - app user who requested the promotion + proposer: `5abf5064861d950f157c4a09` (string, required) - id of app user who requested the promotion
+ timestamp: `2018-03-25T18:54:21.609Z` (string, required) - creation timestamp + timestamp: `2018-03-25T18:54:21.609Z` (string, required) - creation timestamp
+ updatedAt: `2018-03-25T18:54:21.609Z` (string, required) - version timestamp + updatedAt: `2018-03-25T18:54:21.609Z` (string, required) - version timestamp
+ userId (User, required) - populated user instance of user the promotion is requested for + userId: `5ab68d42f547ed304064e5f7` (string, required) - id of army member the promotion is requested for
+ __v: 0 (number, required) - version number of promotion instance + __v: 0 (number, required) - version number of promotion instance
# PromotionPopulated (object)
Promotion with populated proposer and army member
## Properties
+ proposer (Proposer, required) - app user who requested the promotion
+ userId (User, required) - populated user instance of user the promotion is requested for

View File

@ -4,13 +4,13 @@ A rank that can be applied to army members by level/fraction
## Properties ## Properties
+ _id: `591469c9ef4a6810623ed4ea` (string, required) - the unique id of the rank + _id: `591469c9ef4a6810623ed4ea` (string, required) - the unique id of the rank
+ name: `Gefreiter` - display name of the rank + name: `Gefreiter` (string, required) - display name of the rank
+ fraction: `BLUFOR` - enum expressing the fraction in which the decoration is given + fraction: `BLUFOR` (enum, required) - enum expressing the fraction in which the decoration is given
+ Members + Members
+ `BLUFOR` + `BLUFOR`
+ `OPFOR` + `OPFOR`
+ `GLOBAL` + `GLOBAL`
+ level: 1 - rank level + level: 1 (number, required) - rank level
+ updatedAt: `2017-09-20T20:25:29.995Z` (string, required) - the version timestamp + updatedAt: `2017-09-20T20:25:29.995Z` (string, required) - the version timestamp
+ timestamp: `2017-05-11T13:40:25.051Z` - the creation timestamp + timestamp: `2017-05-11T13:40:25.051Z` (string, required) - the creation timestamp
+ __v: 1 - version number + __v: 1 (number, required) - version number

View File

@ -5,6 +5,18 @@ A participant managed in the system
+ _id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of the army member + _id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of the army member
+ username: `Jagernaut` (string, required) - the displayed username of the army member + username: `Jagernaut` (string, required) - the displayed username of the army member
+ rankLvl: 22 (number, required) - rank level representing the rank + rankLvl: 22 (number, required) - rank level representing the rank
+ squadId (Squad, required) - populated squad which the army member is part of + squadId: `591470249e9fae286e008e31` (string, required, nullable) - id of squad which the army member is part of
+ updatedAt: `2018-02-24T01:01:25.825Z` - the version timestamp + updatedAt: `2018-02-24T01:01:25.825Z` - the version timestamp
+ __v: 35 (number, required) - the version number of the object + __v: 35 (number, required) - the version number of the object
# UserPopulated (User)
User object with populated squad
## Properties
+ squadId (Squad, required) - populated squad which the army member is part of
# UserInclTimestamp (User)
A participant managed in the system, incl. creation timestamp
## Properties
+ timestamp: 2018-01-20T12:11:23.125Z (string, required) - instance creation timestamp

View File

@ -15,7 +15,12 @@ A war as used in statistics
+ 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
# WarWithPlayers (War)
A war response object on creation
## Properties
+ players (array[WarPlayer], required) - collection of all participating players with their statistics

View File

@ -5,7 +5,7 @@ Get single campaign information
+ Parameters + Parameters
+ id: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of campaign + id: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of campaign
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (Campaign, fixed-type) + Attributes (Campaign, fixed-type)
@ -18,7 +18,7 @@ Create a new campaign
+ Attributes + Attributes
+ title: `Return To Kessel In A Schmelz` (string, required) - display name of the campaign + title: `Return To Kessel In A Schmelz` (string, required) - display name of the campaign
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (Campaign, fixed-type) + Attributes (Campaign, fixed-type)

View File

@ -1,12 +1,12 @@
### Get Wars [GET /wars] ### List Wars [GET /wars]
List all wars List all wars, subordinate to their campaign
+ Response 200 + Response 200 (application/json; charset=utf-8)
+ Attributes (array[War], fixed-type) + Attributes (array[WarCampaign], fixed-type)
### GET War [GET /wars/{id}] ### Get War [GET /wars/{id}]
Retrieve single war data Retrieve single war data
@ -15,7 +15,7 @@ Retrieve single war data
+ Response 200 (application/json; charset=utf-8) + Response 200 (application/json; charset=utf-8)
+ Attributes (War, fixed-type) + Attributes (WarWithPlayers, fixed-type)
### Create War [POST /wars] ### Create War [POST /wars]
@ -70,7 +70,7 @@ Create a new war
2018/03/20, 22:35:43 "[OPT] (Punkte) LOG: 2:30:00 --- Endpunktestand: (NATO 34 | CSAT 25)" 2018/03/20, 22:35:43 "[OPT] (Punkte) LOG: 2:30:00 --- Endpunktestand: (NATO 34 | CSAT 25)"
-----BOUNDARY-- -----BOUNDARY--
+ Response 201 + Response 201 (application/json; charset=utf-8)
+ Attributes (War, fixed-type) + Attributes (War, fixed-type)

View File

@ -78,7 +78,7 @@ authenticate.route('/signup')
.post((req, res, next) => { .post((req, res, next) => {
create(req.body) create(req.body)
.then(() => { .then(() => {
res.sendStatus(201); res.send(201, {message: 'User successfully created'});
}) })
.catch((err) => { .catch((err) => {
res.status(400).send(err); res.status(400).send(err);