diff --git a/api/apib/army-management/army.apib b/api/apib/army-management/army.apib index 121fa33..df7fac4 100644 --- a/api/apib/army-management/army.apib +++ b/api/apib/army-management/army.apib @@ -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 -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (ArmyOverview) diff --git a/api/apib/army-management/awardings.apib b/api/apib/army-management/awardings.apib index 6549f22..df5cc5d 100644 --- a/api/apib/army-management/awardings.apib +++ b/api/apib/army-management/awardings.apib @@ -20,9 +20,9 @@ List all awardings + `GLOBAL` -+ Response 200 ++ Response 200 (application/json; charset=utf-8) - + Attributes (array[Awarding], fixed-type) + + Attributes (array[AwardingPopulated], fixed-type) ### 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 + proposer: `5ab68ceef547ed304064e5f6` (string, required) - app user id, who requested this awarding -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + 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 + reason: `Good boy` (string, required) - reason for giving the awarding -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (Awarding, fixed-type) diff --git a/api/apib/army-management/decorations.apib b/api/apib/army-management/decorations.apib index 49d4e6a..4ba3a3b 100644 --- a/api/apib/army-management/decorations.apib +++ b/api/apib/army-management/decorations.apib @@ -1,4 +1,4 @@ -### GET Decorations [GET /decorations{?q,fractFilter}] +### List Decorations [GET /decorations{?q,fractFilter}] List all decorations @@ -14,19 +14,19 @@ List all decorations + `OPFOR` + `GLOBAL` -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (array[Decoration], fixed-type) -### GET Decoration [GET /decorations/{id}] +### Get Decoration [GET /decorations/{id}] Retrieve single decoration data + Parameters + id: `5abd3dff6e6a0334d95b8ba0` (string, required) - unique id of the decoration to fetch -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Decoration, fixed-type) @@ -65,7 +65,7 @@ Create a new decoration QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (Decoration, fixed-type) @@ -107,7 +107,7 @@ Update decoration, identified by its id QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Decoration, fixed-type) diff --git a/api/apib/army-management/promotions.apib b/api/apib/army-management/promotions.apib index 049a305..042e041 100644 --- a/api/apib/army-management/promotions.apib +++ b/api/apib/army-management/promotions.apib @@ -1,4 +1,4 @@ -### GET Promotions [GET /promotion{?squadId,inProgress,fractFilter}] +### List Promotions [GET /request/promotion{?squadId,inProgress,fractFilter}] List all promotion requests @@ -19,9 +19,9 @@ List all promotion requests + `OPFOR` + `GLOBAL` -+ Response 200 ++ Response 200 (application/json; charset=utf-8) - + Attributes (array[Promotion]) + + Attributes (array[PromotionPopulated]) ### 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 + newRankLvl: 5 (number, required) - new rank level to apply -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (Promotion, fixed-type) @@ -60,6 +60,6 @@ Update the promotion proposal + 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 -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Promotion, fixed-type) diff --git a/api/apib/army-management/ranks.apib b/api/apib/army-management/ranks.apib index ac5d046..bc5e39b 100644 --- a/api/apib/army-management/ranks.apib +++ b/api/apib/army-management/ranks.apib @@ -1,4 +1,4 @@ -### GET Ranks [GET /ranks{?q,fractFilter}] +### List Ranks [GET /ranks{?q,fractFilter}] List all ranks @@ -13,19 +13,19 @@ List all ranks + `OPFOR` + `GLOBAL` -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (array[Rank], fixed-type) -### GET Rank [GET /ranks/{id}] +### Get Rank [GET /ranks/{id}] Retrieve single rank data + Parameters + id: `5aba5504eadcce6332c6a775` (string, required) - unique id of the rank to fetch -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Rank, fixed-type) @@ -59,7 +59,7 @@ Create a new rank QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (Rank, fixed-type) @@ -96,7 +96,7 @@ Update rank, identified by its id QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Rank, fixed-type) diff --git a/api/apib/army-management/squads.apib b/api/apib/army-management/squads.apib index 33425a5..046bcb9 100644 --- a/api/apib/army-management/squads.apib +++ b/api/apib/army-management/squads.apib @@ -1,4 +1,4 @@ -### Get Squads [GET /squads{?q,fractFilter}] +### List Squads [GET /squads{?q,fractFilter}] Get single army member information @@ -13,7 +13,7 @@ Get single army member information + `OPFOR` + `GLOBAL` -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (array[Squad], fixed-type) @@ -24,7 +24,7 @@ Get single squad information + Parameters + id: `5aba54eaeadcce6332c6a774` (string, required) - unique id of the squad -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Squad, fixed-type) @@ -53,7 +53,7 @@ Create a new squad QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (Squad, fixed-type) @@ -90,7 +90,7 @@ Update squad, identified by its id QObYZgAAAApJREFUeJxjYgAAAAYAAzY3fKgAAAAASUVORK5CYII= -----BOUNDARY-- -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Squad, fixed-type) diff --git a/api/apib/army-management/users.apib b/api/apib/army-management/users.apib index f6c7381..c581371 100644 --- a/api/apib/army-management/users.apib +++ b/api/apib/army-management/users.apib @@ -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 @@ -23,13 +23,13 @@ Get single army member information + Default: 0 -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Headers X-Total-Count: 1 - + Attributes (array[User], fixed-type) + + Attributes (array[UserPopulated], fixed-type) ### Get User [GET /users/{id}] @@ -39,9 +39,9 @@ Get single army member information + Parameters + 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] @@ -53,9 +53,9 @@ Create a new army member + Attributes + 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}] @@ -72,7 +72,7 @@ Update an army member, identified by its id + rankLvl: 22 (number, optional) - rank level representing the rank + 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) diff --git a/api/apib/auth/login.apib b/api/apib/auth/login.apib index e0a4023..3063457 100644 --- a/api/apib/auth/login.apib +++ b/api/apib/auth/login.apib @@ -6,6 +6,6 @@ Generate a token which can be used to make API requests. + Attributes (Login) -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (LoginResponse) diff --git a/api/apib/auth/signup.apib b/api/apib/auth/signup.apib index 5f3027b..66fc5f0 100644 --- a/api/apib/auth/signup.apib +++ b/api/apib/auth/signup.apib @@ -6,4 +6,8 @@ Create a new application user account. + Attributes (Registration) -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + + + Attributes + + + message: `User successfully created` (string, required) diff --git a/api/apib/data_structures/_auth.apib b/api/apib/data_structures/_auth.apib index cdafe3b..9ebbb4f 100644 --- a/api/apib/data_structures/_auth.apib +++ b/api/apib/data_structures/_auth.apib @@ -13,9 +13,9 @@ Response object on successful token creation + _id: `593d632772d35225232bcabb` (string, required) - the unique id 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 -+ 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 diff --git a/api/apib/data_structures/_awarding.apib b/api/apib/data_structures/_awarding.apib index e49da85..bf2acfe 100644 --- a/api/apib/data_structures/_awarding.apib +++ b/api/apib/data_structures/_awarding.apib @@ -2,13 +2,21 @@ Awarding associating a decoration to a user ## 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) + 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 -+ 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 + 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 + __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 diff --git a/api/apib/data_structures/_campaign.apib b/api/apib/data_structures/_campaign.apib index 4470bc5..ea79121 100644 --- a/api/apib/data_structures/_campaign.apib +++ b/api/apib/data_structures/_campaign.apib @@ -7,3 +7,10 @@ Campaign entity + timestamp: `2017-05-17T19:44:28.751Z` (string, required) - creation date + updatedAt: `"2017-05-17T19:44:28.751Z` (string, required) - version date + __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) diff --git a/api/apib/data_structures/_promotion.apib b/api/apib/data_structures/_promotion.apib index 4c8a7ad..48e5aaa 100644 --- a/api/apib/data_structures/_promotion.apib +++ b/api/apib/data_structures/_promotion.apib @@ -4,10 +4,17 @@ Representation of a promotion request for a army member ## Properties + _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) -+ newRankLvl: 14 - new rank level that is requested in this promotion -+ oldRankLvl: 10 - old rank level of the user -+ proposer (Proposer, required) - app user who requested the promotion ++ newRankLvl: 14 (number, required)- new rank level that is requested in this promotion ++ oldRankLvl: 10 (number, required)- old rank level of the user ++ proposer: `5abf5064861d950f157c4a09` (string, required) - id of app user who requested the promotion + timestamp: `2018-03-25T18:54:21.609Z` (string, required) - creation 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 + +# 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 diff --git a/api/apib/data_structures/_rank.apib b/api/apib/data_structures/_rank.apib index 038ceb8..7cfd9e0 100644 --- a/api/apib/data_structures/_rank.apib +++ b/api/apib/data_structures/_rank.apib @@ -4,13 +4,13 @@ A rank that can be applied to army members by level/fraction ## Properties + _id: `591469c9ef4a6810623ed4ea` (string, required) - the unique id of the rank -+ name: `Gefreiter` - display name of the rank -+ fraction: `BLUFOR` - enum expressing the fraction in which the decoration is given ++ name: `Gefreiter` (string, required) - display name of the rank ++ fraction: `BLUFOR` (enum, required) - enum expressing the fraction in which the decoration is given + Members + `BLUFOR` + `OPFOR` + `GLOBAL` -+ level: 1 - rank level ++ level: 1 (number, required) - rank level + updatedAt: `2017-09-20T20:25:29.995Z` (string, required) - the version timestamp -+ timestamp: `2017-05-11T13:40:25.051Z` - the creation timestamp -+ __v: 1 - version number ++ timestamp: `2017-05-11T13:40:25.051Z` (string, required) - the creation timestamp ++ __v: 1 (number, required) - version number diff --git a/api/apib/data_structures/_user.apib b/api/apib/data_structures/_user.apib index b9d9d98..c6b4c4a 100644 --- a/api/apib/data_structures/_user.apib +++ b/api/apib/data_structures/_user.apib @@ -5,6 +5,18 @@ A participant managed in the system + _id: `5ab68d42f547ed304064e5f7` (string, required) - unique id of the army member + username: `Jagernaut` (string, required) - the displayed username of the army member + 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 + __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 diff --git a/api/apib/data_structures/_war.apib b/api/apib/data_structures/_war.apib index 075d309..0257ccd 100644 --- a/api/apib/data_structures/_war.apib +++ b/api/apib/data_structures/_war.apib @@ -15,7 +15,12 @@ A war as used in statistics + budgetOpfor: 4100000 (number, required) - start budget of fraction Opfor + endBudgetBlufor: 924000 (number, required) - end budget of fraction Blufor + 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 + updatedAt: `2018-02-24T01:01:25.825Z` (string, required) - the version timestamp + __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 diff --git a/api/apib/statistics/campaigns.apib b/api/apib/statistics/campaigns.apib index 08822f9..83b5d9f 100644 --- a/api/apib/statistics/campaigns.apib +++ b/api/apib/statistics/campaigns.apib @@ -5,7 +5,7 @@ Get single campaign information + Parameters + id: `5abd55ea9e30a76bfef747d6` (string, required) - unique id of campaign -+ Response 200 ++ Response 200 (application/json; charset=utf-8) + Attributes (Campaign, fixed-type) @@ -18,7 +18,7 @@ Create a new campaign + Attributes + 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) diff --git a/api/apib/statistics/wars.apib b/api/apib/statistics/wars.apib index 32c9c8c..16f2b73 100644 --- a/api/apib/statistics/wars.apib +++ b/api/apib/statistics/wars.apib @@ -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 @@ -15,7 +15,7 @@ Retrieve single war data + Response 200 (application/json; charset=utf-8) - + Attributes (War, fixed-type) + + Attributes (WarWithPlayers, fixed-type) ### 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)" -----BOUNDARY-- -+ Response 201 ++ Response 201 (application/json; charset=utf-8) + Attributes (War, fixed-type) diff --git a/api/routes/authenticate.js b/api/routes/authenticate.js index 205b777..22db98f 100644 --- a/api/routes/authenticate.js +++ b/api/routes/authenticate.js @@ -78,7 +78,7 @@ authenticate.route('/signup') .post((req, res, next) => { create(req.body) .then(() => { - res.sendStatus(201); + res.send(201, {message: 'User successfully created'}); }) .catch((err) => { res.status(400).send(err);