Use fraction Enum for admin panel and adjust account order
parent
3330eaa87f
commit
fa2c802e4e
|
@ -14,10 +14,9 @@ const AppUserModel = require('../models/app-user');
|
||||||
|
|
||||||
const account = express.Router();
|
const account = express.Router();
|
||||||
|
|
||||||
|
|
||||||
account.route('/')
|
account.route('/')
|
||||||
.get((req, res, next) => {
|
.get((req, res, next) => {
|
||||||
AppUserModel.find({}).populate('squad').exec((err, items) => {
|
AppUserModel.find({}, {}, {sort: {username: 1}}).populate('squad').exec((err, items) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
err.status = codes.servererror;
|
err.status = codes.servererror;
|
||||||
return next(err);
|
return next(err);
|
||||||
|
@ -81,10 +80,8 @@ account.route('/:id')
|
||||||
routerHandling.httpMethodNotAllowed
|
routerHandling.httpMethodNotAllowed
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// this middleware function can be used, if you like or remove it
|
// 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
|
// it looks for object(s) in res.locals.items and if they exist, they are send to the client as json
|
||||||
account.use(routerHandling.emptyResponse);
|
account.use(routerHandling.emptyResponse);
|
||||||
|
|
||||||
|
|
||||||
module.exports = account;
|
module.exports = account;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
(change)="updateAppUser(user)">
|
(change)="updateAppUser(user)">
|
||||||
<option [value]="0">Ohne Fraktion/ Squad</option>
|
<option [value]="0">Ohne Fraktion/ Squad</option>
|
||||||
<option *ngFor="let squad of squads" [ngValue]="squad">
|
<option *ngFor="let squad of squads" [ngValue]="squad">
|
||||||
{{squad.fraction == 'BLUFOR'? 'NATO' : 'CSAT'}}: {{squad.name}}
|
{{squad.fraction == 'BLUFOR'? fraction.BLUFOR : fraction.OPFOR}}: {{squad.name}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {AppUser, Squad} from "../models/model-interfaces";
|
||||||
import {Observable} from "rxjs/Observable";
|
import {Observable} from "rxjs/Observable";
|
||||||
import {AppUserService} from "../services/app-user-service/app-user.service";
|
import {AppUserService} from "../services/app-user-service/app-user.service";
|
||||||
import {SquadService} from "../services/army-management/squad.service";
|
import {SquadService} from "../services/army-management/squad.service";
|
||||||
|
import {Fraction} from "../utils/fraction.enum";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -18,6 +19,8 @@ export class AdminComponent {
|
||||||
|
|
||||||
showSuccessLabel = false;
|
showSuccessLabel = false;
|
||||||
|
|
||||||
|
readonly fraction = Fraction;
|
||||||
|
|
||||||
constructor(private appUserService: AppUserService,
|
constructor(private appUserService: AppUserService,
|
||||||
private squadService: SquadService) {
|
private squadService: SquadService) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue