Compare commits

..

No commits in common. "c64700ed3892dc247e7c5cade7e4f600c2ab4530" and "e284fffdee1dc2e4894e1a448b9c84ed88dc1f9a" have entirely different histories.

12 changed files with 51 additions and 161 deletions

View File

@ -1,24 +1,18 @@
### GET Awardings [GET /awardings{?userId,inProgress,fractFilter}] ### GET Awardings [GET /awardings{?userId,confirmed}]
List all awardings List all awardings
+ Parameters + Parameters
+ userId (string, optional) + userId (string, optional)
specific army member Id to show the awardings for specific army member Id to show the awardings for
+ inProgress (boolean, optional) + confirmed (number, optional)
true to filter by awarding state 'in progress' Field to filter by request awarding state
+ Default: false
+ fractFilter (enum[string], optional)
Field to filter by fraction
+ Members + Members
+ `BLUFOR` + 0 - not decided
+ `OPFOR` + 1 - confirmed
+ `GLOBAL` + 2 - rejected
+ Response 200 + Response 200

View File

@ -1,25 +0,0 @@
### GET Promotions [GET /promotion{?squadId,inProgress,fractFilter}]
List all promotion requests
+ Parameters
+ squadId (string, optional)
specific squad Id to show the promotion requests for
+ inProgress (boolean, optional)
true to filter by promotion state 'in progress'
+ Default: false
+ fractFilter (enum[string], optional)
Field to filter by fraction
+ Members
+ `BLUFOR`
+ `OPFOR`
+ `GLOBAL`
+ Response 200
+ Attributes (array[Promotion])

View File

@ -1,31 +1,3 @@
### GET Users [GET /users{?q,fractFilter,limit,offset}]
Get single army member information
+ Parameters
+ q: `hardi` (string, optional) - filter string which filters for partial username
+ fractFilter (enum[string], optional)
Field to filter by fraction
+ Members
+ `BLUFOR`
+ `OPFOR`
+ `GLOBAL`
+ limit: 20 (number, optional)
Maximum number of users to return
+ offset (number, optional)
Offset into result-set (useful for pagination)
+ Default: 0
+ Response 200
+ Attributes (array[User])
### GET User [GET /users/{id}] ### GET User [GET /users/{id}]
Get single army member information Get single army member information

View File

@ -1,36 +0,0 @@
The running express server instance saves entity related files like squad logos and statistic logs on the file system.
In the original mean application they are served in the `/resource` path of the application server.
The following examples show where those files are located, to be accessed on the cloud instance.
## Images
**Decoration Image**
`https://cc.noarch.de/resource/decoration/{decorationId}.png`
**Rank Image**
`https://cc.noarch.de/resource/rank/{rankId}.png`
**Signature Image**
`https://cc.noarch.de/resource/signature/{userId}.png`
**Squad Logo**
`https://cc.noarch.de/resource/squad/{squadId}.png`
## Log-Files
**Sanitized Log File**
`https://cc.noarch.de/resource/logs/{warId}/clean.log`
**Original Uploaded Log File**
`https://cc.noarch.de/resource/logs/{warId}/war.log`

View File

@ -1,8 +0,0 @@
# Proposer (object)
Representation of an app user who proposed an awarding or a promotion
## Properties
+ _id: `593d5e3f72d35225222bcaba` (string, required) - unique id of the app user
+ username: `hardiready` (string, required) - username of the app user
+ squad: `591470249e9fae286e308e41` (string, required) - squad id associated with the app user

View File

@ -7,7 +7,6 @@ Awarding associating a decoration to a user
+ 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 (Decoration, required) - populated decoration object 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
+ 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

View File

@ -1,13 +0,0 @@
# Promotion (object)
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
+ 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
+ __v: 0 (number, required) - version number of promotion instance

View File

@ -1,7 +1,5 @@
# Data Structures # Data Structures
:[Gists](_app-user.apib)
:[Gists](_army.apib) :[Gists](_army.apib)
:[Gists](_auth.apib) :[Gists](_auth.apib)
@ -10,8 +8,6 @@
:[Gists](_decoration.apib) :[Gists](_decoration.apib)
:[Gists](_promotion.apib)
:[Gists](_squad.apib) :[Gists](_squad.apib)
:[Gists](_user.apib) :[Gists](_user.apib)

View File

@ -10,10 +10,6 @@ FORMAT: 1A
:[Gists](base/datetime.apib) :[Gists](base/datetime.apib)
# Group File Resources
:[Gists](base/file-resources.apib)
# Group Access # Group Access
:[Gists](auth/signup.apib) :[Gists](auth/signup.apib)
@ -22,10 +18,6 @@ FORMAT: 1A
# Group Account # Group Account
# Group Army Overview
:[Gists](army-management/army.apib)
# Group Awardings # Group Awardings
:[Gists](army-management/awardings.apib) :[Gists](army-management/awardings.apib)
@ -38,14 +30,16 @@ FORMAT: 1A
# Group Logs # Group Logs
# Group Overview
:[Gists](overview/army.apib)
# Group Players # Group Players
# Group Ranks # Group Ranks
# Group Requests # Group Requests
:[Gists](army-management/promotions.apib)
# Group Squads # Group Squads
# Group Users # Group Users

View File

@ -32,30 +32,47 @@ awarding.route('/')
if (req.query.inProgress) { if (req.query.inProgress) {
filter.confirmed = 0; filter.confirmed = 0;
} }
AwardingModel.find(filter, {}, {sort: {date: 'desc'}}) if (req.query.simple) {
.populate('decorationId').populate('proposer', resultSet) AwardingModel.find(filter, {}, {sort: {date: 'desc'}}, (err, items) => {
.exec((err, items) => { if (err) {
if (err) { err.status = codes.servererror;
err.status = codes.servererror; return next(err);
return next(err); // with return before (or after) the next(err) we prevent that the code continues here after next(err)
// with return before (or after) the next(err) we prevent that the code continues here // has finished. this saves an extra else {..}
// after next(err) has finished. this saves an extra else {..} }
} // if the collection is empty we do not send empty arrays back.
let results = []; if (items && items.length > 0) {
if (req.query.fractFilter) { res.locals.items = items;
for (let item of items) { }
if (item.decorationId.fraction === req.query.fractFilter) { res.locals.processed = true;
results.push(item); next();
} });
} else {
AwardingModel.find(filter, {}, {sort: {date: 'desc'}})
.populate('decorationId').populate('proposer', resultSet)
.exec((err, items) => {
if (err) {
err.status = codes.servererror;
return next(err);
// with return before (or after) the next(err) we prevent that the code continues here
// after next(err) has finished. this saves an extra else {..}
}
let results = [];
if (req.query.fractFilter) {
for (let item of items) {
if (item.decorationId.fraction === req.query.fractFilter) {
results.push(item);
}
}
res.locals.items = results;
} else {
res.locals.items = items;
} }
res.locals.items = results;
} else {
res.locals.items = items;
}
res.locals.processed = true; res.locals.processed = true;
next(); next();
}); });
}
}) })
.post(apiAuthenticationMiddleware, checkHl, (req, res, next) => { .post(apiAuthenticationMiddleware, checkHl, (req, res, next) => {

View File

@ -58,7 +58,7 @@ request.route('/award')
request.route('/promotion') request.route('/promotion')
.get((req, res, next) => { .get((req, res, next) => {
// TODO: add SQL authentication? // TODO: add SQL authentication
const squadFilter = req.query.squadId; const squadFilter = req.query.squadId;
const fractFilter = req.query.fractFilter; const fractFilter = req.query.fractFilter;
const progressFilter = req.query.inProgress; const progressFilter = req.query.inProgress;