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();
|
||||
|
||||
|
||||
account.route('/')
|
||||
.get((req, res, next) => {
|
||||
AppUserModel.find({}).populate('squad').exec((err, items) => {
|
||||
AppUserModel.find({}, {}, {sort: {username: 1}}).populate('squad').exec((err, items) => {
|
||||
if (err) {
|
||||
err.status = codes.servererror;
|
||||
return next(err);
|
||||
|
@ -81,10 +80,8 @@ account.route('/:id')
|
|||
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
|
||||
account.use(routerHandling.emptyResponse);
|
||||
|
||||
|
||||
module.exports = account;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
(change)="updateAppUser(user)">
|
||||
<option [value]="0">Ohne Fraktion/ Squad</option>
|
||||
<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>
|
||||
</select>
|
||||
</td>
|
||||
|
|
|
@ -3,6 +3,7 @@ import {AppUser, Squad} from "../models/model-interfaces";
|
|||
import {Observable} from "rxjs/Observable";
|
||||
import {AppUserService} from "../services/app-user-service/app-user.service";
|
||||
import {SquadService} from "../services/army-management/squad.service";
|
||||
import {Fraction} from "../utils/fraction.enum";
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -18,6 +19,8 @@ export class AdminComponent {
|
|||
|
||||
showSuccessLabel = false;
|
||||
|
||||
readonly fraction = Fraction;
|
||||
|
||||
constructor(private appUserService: AppUserService,
|
||||
private squadService: SquadService) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue