diff --git a/api/models/war.js b/api/models/war.js index 1e279cc..82a3a86 100644 --- a/api/models/war.js +++ b/api/models/war.js @@ -4,6 +4,10 @@ const mongoose = require('mongoose'); const Schema = mongoose.Schema; const WarSchema = new Schema({ + title: { + type: String, + required: true + }, date: { type: Date, required: true diff --git a/api/routes/war.js b/api/routes/wars.js similarity index 98% rename from api/routes/war.js rename to api/routes/wars.js index 9e2031c..9bf6041 100644 --- a/api/routes/war.js +++ b/api/routes/wars.js @@ -27,7 +27,7 @@ const wars = express.Router(); wars.route('/') .get((req, res, next) => { const filter = {}; - WarModel.find(filter, {}, {sort: {date: 'asc'}}, (err, items) => { + WarModel.find(filter, {}, {sort: {date: 'desc'}}, (err, items) => { if (err) { err.status = codes.servererror; return next(err); diff --git a/api/server.js b/api/server.js index 0cbeec8..f02fbeb 100644 --- a/api/server.js +++ b/api/server.js @@ -31,7 +31,7 @@ const awardingRouter = require('./routes/awardings'); const requestRouter = require('./routes/request'); const signatureRouter = require('./routes/signatures'); const commandRouter = require('./routes/command'); -const warRouter = require('./routes/war'); +const warRouter = require('./routes/wars'); // Configuration *********************************** // mongoose promise setup diff --git a/api/war-parser/clean.sh b/api/war-parser/clean.sh index 68f2130..be0cd7d 100755 --- a/api/war-parser/clean.sh +++ b/api/war-parser/clean.sh @@ -17,4 +17,4 @@ while IFS= read -r line; do echo "$line" echo "" fi -done < <(grep -A 200 Scoreboard ${FILE} ) +done < <(grep -A 100 Scoreboard ${FILE} ) diff --git a/static/src/app/app.component.html b/static/src/app/app.component.html index bcf3a01..c23c207 100644 --- a/static/src/app/app.component.html +++ b/static/src/app/app.component.html @@ -21,6 +21,18 @@
  • Armeeübersicht
  • +
  • Teilnehmer
  • diff --git a/static/src/app/app.component.ts b/static/src/app/app.component.ts index 0d796f7..820b6b5 100644 --- a/static/src/app/app.component.ts +++ b/static/src/app/app.component.ts @@ -7,6 +7,8 @@ import { import {LoginService} from './services/login-service/login-service'; import {Title} from '@angular/platform-browser'; import {AUTH_ENABLED} from './app.tokens'; +import {WarService} from "./services/war-service/war.service"; +import {War} from "./models/model-interfaces"; @Component({ selector: 'app-root', @@ -17,8 +19,11 @@ export class AppComponent { defaultTitle: string; + wars: War[] = []; + constructor(@Optional() @Inject(AUTH_ENABLED) public authEnabled, private loginService: LoginService, + private warService: WarService, private activatedRoute: ActivatedRoute, private router: Router, private titleService: Title) { @@ -31,7 +36,11 @@ export class AppComponent { .filter(event => event instanceof NavigationEnd) .subscribe(event => { this.setBrowserTitle(); - }) + }); + this.warService.getAllWars().subscribe((wars) => { + this.wars = wars; + }) + } setBrowserTitle() { diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts index f66fa03..18cb679 100644 --- a/static/src/app/models/model-interfaces.ts +++ b/static/src/app/models/model-interfaces.ts @@ -29,6 +29,7 @@ export interface Player { } export interface War { _id?: string; + title?: string; date?: Date; ptBlufor?: number; ptOpfor?: number; diff --git a/static/src/app/wars/war-detail.component.html b/static/src/app/wars/war-detail.component.html index e45bcd4..730b8b9 100644 --- a/static/src/app/wars/war-detail.component.html +++ b/static/src/app/wars/war-detail.component.html @@ -1,7 +1,7 @@
    -

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

    +

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

    Endpunktestand:

    NATO {{war.ptBlufor}} @@ -9,7 +9,8 @@ {{war.ptOpfor}} CSAT -
    +
    + Logfile anzeigen