diff --git a/api/routes/campaigns.js b/api/routes/campaigns.js index 6864cc5..b095dbf 100644 --- a/api/routes/campaigns.js +++ b/api/routes/campaigns.js @@ -8,6 +8,8 @@ const logger = require('debug')('cc:campaigns'); const codes = require('./http-codes'); const routerHandling = require('../middleware/router-handling'); +const apiAuthenticationMiddleware = require('../middleware/auth-middleware'); +const checkMT = require('../middleware/permission-check').checkMT; // Mongoose Model using mongoDB const CampaignModel = require('../models/campaign'); @@ -17,7 +19,7 @@ const campaigns = express.Router(); // routes ********************** campaigns.route('/') - .post((req, res, next) => { + .post(apiAuthenticationMiddleware, checkMT, (req, res, next) => { const campaign = new CampaignModel(req.body); // timestamp and default are set automatically by Mongoose Schema Validation campaign.save((err) => { @@ -36,6 +38,26 @@ campaigns.route('/') routerHandling.httpMethodNotAllowed ); +campaigns.route('/:id') + .get((req, res, next) => { + CampaignModel.findById(req.params.id, (err, item) => { + if (err) { + err.status = codes.servererror; + return next(err); + } + else if (!item) { + err = new Error("item not found"); + err.status = codes.notfound; + return next(err); + } + res.locals.items = item; + return next(); + }); + }) + .all( + routerHandling.httpMethodNotAllowed + ); + // this middleware function can be used, if you like or remove it // it looks for object(s) in res.locals.items and if they exist, they are send to the client as json campaigns.use(routerHandling.emptyResponse); diff --git a/api/server.js b/api/server.js index d1d2ef2..9c203a9 100644 --- a/api/server.js +++ b/api/server.js @@ -15,7 +15,6 @@ const urls = require('./config/api-url'); const restAPIchecks = require('./middleware/request-checks.js'); const errorResponseWare = require('./middleware/error-response'); const apiAuthenticationMiddleware = require('./middleware/auth-middleware'); -const checkMT = require('./middleware/permission-check').checkMT; const checkAdmin = require('./middleware/permission-check').checkAdmin; const signatureCronJob = require('./cron-job/cron').cronJobSignature; const backupCronJob = require('./cron-job/cron').cronJobBackup; @@ -81,7 +80,7 @@ app.use(urls.decorations, decorationRouter); app.use(urls.request, requestRouter); app.use(urls.awards, awardingRouter); app.use(urls.wars, warRouter); -app.use(urls.campaigns, apiAuthenticationMiddleware, checkMT, campaignRouter); +app.use(urls.campaigns,campaignRouter); app.use(urls.command, apiAuthenticationMiddleware, checkAdmin, commandRouter); app.use(urls.account, apiAuthenticationMiddleware, checkAdmin, accountRouter); diff --git a/static/src/app/decorations/decoration-list/decoration-item.component.html b/static/src/app/decorations/decoration-list/decoration-item.component.html index f60ded5..4e8fe41 100644 --- a/static/src/app/decorations/decoration-list/decoration-item.component.html +++ b/static/src/app/decorations/decoration-list/decoration-item.component.html @@ -1,7 +1,7 @@
-
+
{{decoration.name}} @@ -12,7 +12,7 @@ - Sortierung: {{decoration.sortingNumber}}
-
+
-
+
{{rank.name}} @@ -11,7 +11,7 @@ - Stufe {{rank.level}}
-
+
diff --git a/static/src/app/squads/squad-list/squad-item.component.html b/static/src/app/squads/squad-list/squad-item.component.html index a1e7aea..43827b6 100644 --- a/static/src/app/squads/squad-list/squad-item.component.html +++ b/static/src/app/squads/squad-list/squad-item.component.html @@ -1,7 +1,7 @@
-
+
{{squad.name}} @@ -10,7 +10,7 @@ NATO
-
+
diff --git a/static/src/app/statistic/overview/stats-overview.component.css b/static/src/app/statistic/overview/stats-overview.component.css index 68d4fa9..ef060c6 100644 --- a/static/src/app/statistic/overview/stats-overview.component.css +++ b/static/src/app/statistic/overview/stats-overview.component.css @@ -1,9 +1,3 @@ -h3 { - width: 920px; - margin-left: 5%; -} - .chart-container { width: 1200px; - margin-left: 5%; } diff --git a/static/src/app/statistic/overview/stats-overview.component.html b/static/src/app/statistic/overview/stats-overview.component.html index ecbb758..d6c6c1d 100644 --- a/static/src/app/statistic/overview/stats-overview.component.html +++ b/static/src/app/statistic/overview/stats-overview.component.html @@ -1,3 +1,5 @@ +

{{title}}

+

Punkte

diff --git a/static/src/app/statistic/overview/stats-overview.component.ts b/static/src/app/statistic/overview/stats-overview.component.ts index 2243779..138c62e 100644 --- a/static/src/app/statistic/overview/stats-overview.component.ts +++ b/static/src/app/statistic/overview/stats-overview.component.ts @@ -13,6 +13,8 @@ import {ActivatedRoute} from "@angular/router"; }) export class StatisticOverviewComponent { + title = ""; + pointData: any[] = []; playerData: any[] = []; @@ -44,6 +46,11 @@ export class StatisticOverviewComponent { let itemsProcessed = 0; campaigns = campaigns.filter(campaign => id === 'all' || campaign._id === id); campaigns.forEach(campaign => { + if (id === 'all') { + this.title = "Gesamtübersicht" + } else { + this.title = campaign.title + } wars = wars.concat(campaign.wars); itemsProcessed++; if (itemsProcessed === campaigns.length) { diff --git a/static/src/app/statistic/stats.component.css b/static/src/app/statistic/stats.component.css index d9e6a0b..e69de29 100644 --- a/static/src/app/statistic/stats.component.css +++ b/static/src/app/statistic/stats.component.css @@ -1,9 +0,0 @@ -#left { - width: 320px; - float: left; - padding-right: 10px; -} - -#right { - overflow: hidden -} diff --git a/static/src/app/statistic/war-detail/war-detail.component.html b/static/src/app/statistic/war-detail/war-detail.component.html index 604789f..2719f75 100644 --- a/static/src/app/statistic/war-detail/war-detail.component.html +++ b/static/src/app/statistic/war-detail/war-detail.component.html @@ -1,6 +1,6 @@
-
+

{{war.title}} - vom {{war.date | date: 'dd.MM.yyyy'}}

Endpunktestand:

@@ -9,7 +9,7 @@ {{war.ptOpfor}} CSAT -

+

Teilnehmer:

-
+
Logfile anzeigen
@@ -50,7 +50,7 @@
-
+
diff --git a/static/src/app/statistic/war-list/war-list.component.html b/static/src/app/statistic/war-list/war-list.component.html index d1e440c..4a86e4d 100644 --- a/static/src/app/statistic/war-list/war-list.component.html +++ b/static/src/app/statistic/war-list/war-list.component.html @@ -5,7 +5,7 @@ -
diff --git a/static/src/app/statistic/war-submit/war-submit.component.html b/static/src/app/statistic/war-submit/war-submit.component.html index eee5b13..44fe2c2 100644 --- a/static/src/app/statistic/war-submit/war-submit.component.html +++ b/static/src/app/statistic/war-submit/war-submit.component.html @@ -42,6 +42,19 @@
+
+ + +
+
-
+
{{user.username}} @@ -11,7 +11,7 @@ ohne Squad/Fraktion
-
+
diff --git a/static/src/styles.css b/static/src/styles.css index 4fec62f..b8fde6e 100644 --- a/static/src/styles.css +++ b/static/src/styles.css @@ -41,17 +41,13 @@ form { #left { width: 20%; - min-width: 280px; + min-width: 350px; max-width: 450px; float: left; padding-right: 10px; + } #right { - overflow: hidden -} - -.chat-button { - position: absolute; - bottom: 0px; - right: 10px; + overflow: hidden; + padding-left: 4%; }