Use fraction Enum for admin panel and adjust account order

pull/18/head
HardiReady 2017-11-08 14:44:32 +01:00
parent 3330eaa87f
commit fa2c802e4e
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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) {
} }