apply new formattinh

pull/29/head
HardiReady 2018-02-26 09:04:27 +01:00
parent b52c5fc484
commit 46642aea4d
77 changed files with 2287 additions and 2246 deletions

View File

@ -54,7 +54,7 @@ const createBackup = () => {
if (err) {
error(err.message);
}
logger('\x1b[32m%s\x1b[0m',stderr);
logger('\x1b[32m%s\x1b[0m', stderr);
logger('\x1b[35m%s\x1b[0m', new Date().toLocaleString()
+ ': cron job finished - CREATE BACKUP');
})

View File

@ -12,8 +12,16 @@ let check = (requiredPermission, actualPermission, res, next) => {
};
module.exports = {
checkSql: (req, res, next) => { check(1, req.user.permission, res, next) },
checkHl: (req, res, next) => { check(2, req.user.permission, res, next) },
checkMT: (req, res, next) => { check(3, req.user.permission, res, next) },
checkAdmin: (req, res, next) => { check(4, req.user.permission, res, next) }
checkSql: (req, res, next) => {
check(1, req.user.permission, res, next)
},
checkHl: (req, res, next) => {
check(2, req.user.permission, res, next)
},
checkMT: (req, res, next) => {
check(3, req.user.permission, res, next)
},
checkAdmin: (req, res, next) => {
check(4, req.user.permission, res, next)
}
};

View File

@ -34,8 +34,8 @@ router.use((req, res, next) => {
// request type application/json check
router.use((req, res, next) => {
if (['POST', 'PUT', 'PATCH'].indexOf(req.method) > -1 &&
(!( /multipart\/form-data/.test(req.get('Content-Type'))) &&
!( /application\/json/.test(req.get('Content-Type'))))) {
(!(/multipart\/form-data/.test(req.get('Content-Type'))) &&
!(/application\/json/.test(req.get('Content-Type'))))) {
// send error code 415: unsupported media type
res.status(415).send('wrong Content-Type'); // user has SEND the wrong type
} else if (!req.accepts('json')) {

View File

@ -11,7 +11,7 @@ const WarSchema = new Schema({
date: {
type: Date,
},
endDate : {
endDate: {
type: Date,
},
ptBlufor: {

View File

@ -45,7 +45,8 @@ account.route('/:id')
req.body.updatedAt = new Date();
req.body.$inc = {__v: 1};
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
AppUserModel.findByIdAndUpdate(req.params.id, req.body, {new: true}).populate('squad').exec((err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -70,7 +71,8 @@ account.route('/:id')
err = new Error("item not found");
err.status = codes.notfound;
}
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
});

View File

@ -44,8 +44,8 @@ awarding.route('/')
if (err) {
err.status = codes.servererror;
return next(err);
// with return before (or after) the next(err) we prevent that the code continues here after next(err) has finished.
// this saves an extra else {..}
// with return before (or after) the next(err) we prevent that the code continues here after next(err)
// has finished. this saves an extra else {..}
}
// if the collection is empty we do not send empty arrays back.
if (items && items.length > 0) {
@ -60,8 +60,8 @@ awarding.route('/')
if (err) {
err.status = codes.servererror;
return next(err);
// with return before (or after) the next(err) we prevent that the code continues here after next(err) has finished.
// this saves an extra else {..}
// with return before (or after) the next(err) we prevent that the code continues here after next(err)
// has finished. this saves an extra else {..}
}
let results = [];
if (req.query.fractFilter) {
@ -118,7 +118,8 @@ awarding.route('/:id')
req.body.updatedAt = new Date();
req.body.$inc = {__v: 1};
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
AwardingModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -143,7 +144,8 @@ awarding.route('/:id')
err = new Error("item not found");
err.status = codes.notfound;
}
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
});

View File

@ -34,7 +34,14 @@ decoration.route('/')
if (req.query.q) {
filter.name = {$regex: req.query.q, $options: 'i'}
}
DecorationModel.find(filter, {}, {sort: {fraction: 'asc', isMedal: 'asc', sortingNumber: 'asc', name: 'asc'}}, (err, items) => {
DecorationModel.find(filter, {}, {
sort: {
fraction: 'asc',
isMedal: 'asc',
sortingNumber: 'asc',
name: 'asc'
}
}, (err, items) => {
if (err) {
err.status = codes.servererror;
return next(err);
@ -112,7 +119,8 @@ decoration.route('/:id')
});
}
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need
// to reset attributes that are missing.
DecorationModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -147,7 +155,8 @@ decoration.route('/:id')
if (err) next(err);
});
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
});

View File

@ -55,7 +55,7 @@ logsRouter.route('/:warId')
flag: flagObjects.exec.bind(flagObjects)
};
async.parallel(resources, function (error, results){
async.parallel(resources, function (error, results) {
if (error) {
res.status(500).send(error);
return;

View File

@ -35,7 +35,15 @@ campaignPlayer.route('/ranking/:campaignId')
const rankingItems = [];
new Set(items.map(x => x.name)).forEach(playerName => {
const playerInstances = items.filter(p => p.name === playerName);
const resItem = {name: playerName, kill: 0, death: 0, friendlyFire: 0, revive: 0, respawn: 0, flagTouch: 0};
const resItem = {
name: playerName,
kill: 0,
death: 0,
friendlyFire: 0,
revive: 0,
respawn: 0,
flagTouch: 0
};
for (let i = 0; i < playerInstances.length; i++) {
resItem.kill += playerInstances[i].kill;
resItem.death += playerInstances[i].death;

View File

@ -114,7 +114,8 @@ ranks.route('/:id')
});
}
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
RankModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -139,7 +140,8 @@ ranks.route('/:id')
err = new Error("item not found");
err.status = codes.notfound;
}
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
})

View File

@ -141,7 +141,8 @@ request.route('/promotion/:id')
req.body.updatedAt = new Date();
req.body.$inc = {__v: 1};
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
PromotionModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;

View File

@ -116,7 +116,8 @@ squads.route('/:id')
});
}
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
SquadModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -147,7 +148,8 @@ squads.route('/:id')
if (err) next(err);
});
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
});

View File

@ -118,7 +118,8 @@ users.route('/:id')
req.body.updatedAt = new Date();
req.body.$inc = {__v: 1};
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to reset attributes that are missing.
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to
// reset attributes that are missing.
UserModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) {
err.status = codes.wrongrequest;
@ -156,7 +157,8 @@ users.route('/:id')
// main difference of PUT and PATCH is that PUT expects all data in request: checked by using the schema
const user = new UserModel(req.body);
UserModel.findById(req.params.id, req.body, {new: true}, function (err, item) {
// with parameter {new: true} the TweetNModel will return the new and changed object from the DB and not the old one.
// with parameter {new: true} the TweetNModel will return the new and changed object from the DB and not the
// old one.
if (err) {
err.status = codes.wrongrequest;
return next(err);
@ -225,7 +227,8 @@ users.route('/:id')
});
}
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next(err); // this works because err is in normal case undefined and that is the same as no parameter
});

View File

@ -207,7 +207,8 @@ wars.route('/:id')
fs.rmdir(warDir, (err) => {
});
}
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler user.use(..)
// we don't set res.locals.items and thus it will send a 204 (no content) at the end. see last handler
// user.use(..)
res.locals.processed = true;
next();

View File

@ -1,5 +1,5 @@
.overview {
padding: 80px 0 0 10%!important;
padding: 80px 0 0 10% !important;
}
.trash {

View File

@ -30,7 +30,7 @@ li {
}
.version-label {
display:block;
display: block;
position: fixed;
top: 32px;
left: 106px;

View File

@ -8,7 +8,7 @@
.army-member-view-container {
width: 90%;
min-width: 870px;
margin:auto
margin: auto
}
.return-button {

View File

@ -2,7 +2,8 @@
<div class="army-member-view-container">
<div class="return-button">
<span class="btn btn-default" style="position:absolute;" (click)="backToOverview()">< zurück zur Übersicht</span>
<h3 class="text-center" style="font-weight: 600" [style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
<h3 class="text-center" style="font-weight: 600"
[style.color]="user.squadId?.fraction === 'BLUFOR' ? fraction.COLOR_BLUFOR : fraction.COLOR_OPFOR">
Auszeichnungen von {{user.username}}
</h3>
</div>

View File

@ -1,6 +1,6 @@
.overview {
width: 100%!important;
margin-left: 25px!important;
width: 100% !important;
margin-left: 25px !important;
}
.decoration-preview {

View File

@ -1,5 +1,5 @@
.overview {
margin-left: 25px!important;
margin-left: 25px !important;
}
.decoration-preview {

View File

@ -1,5 +1,5 @@
.overview {
margin-left: 25px!important;
margin-left: 25px !important;
}
.decoration-preview {

View File

@ -1,5 +1,5 @@
.overview {
margin-left: 25px!important;
margin-left: 25px !important;
}
.decoration-preview {

View File

@ -38,7 +38,8 @@ export class UserService {
}
}).map(res => res.json()).do((users) => {
this.userStore.dispatch({type: action, data: users});
}).subscribe(_ => {});
}).subscribe(_ => {
});
return this.users$;
}

View File

@ -23,7 +23,7 @@ ngx-datatable {
}
:host /deep/ .datatable-header {
width: 350px!important;
width: 350px !important;
background: #222222;
font-weight: 700;
border-radius: 10px 10px 0 0;

View File

@ -22,7 +22,7 @@ export class StatisticHighScoreComponent {
searchTerm = new FormControl();
players : Player = {};
players: Player = {};
playersStored = {};

View File

@ -11,7 +11,7 @@ ngx-datatable {
}
:host /deep/ .datatable-header {
width: 1100px!important;
width: 1100px !important;
background: #222222;
font-weight: 700;
border-radius: 10px 10px 0 0;

View File

@ -38,10 +38,11 @@ export class ScoreboardComponent {
}
ngOnChanges(changes: SimpleChanges) {
this.elRef.nativeElement.querySelector('.datatable-body').scrollTo(0, 0);
if (changes.war) {
this.rows = changes.war.currentValue.players;
this.elRef.nativeElement
.querySelector('.datatable-body')
.scrollTo(0, 0);
}
if (changes.fractionFilterSelected) {
this.filterPlayersByFraction(this.fractionFilterSelected)

View File

@ -1,6 +1,6 @@
.overview {
overflow: hidden!important;
padding-top: 80px!important;
overflow: hidden !important;
padding-top: 80px !important;
width: 20%;
min-width: 280px;
}

View File

@ -26,7 +26,7 @@ div.user-list-entry, a.user-list-entry {
background: lightgrey;
}
span > a, span.glyphicon, span.icon-award{
span > a, span.glyphicon, span.icon-award {
cursor: pointer;
}

View File

@ -14,7 +14,7 @@ export class ChartUtils {
};
}
public static getMultiDataArray(...args: string[]) : any[] {
public static getMultiDataArray(...args: string[]): any[] {
const obj = [];
for (let i = 0, arg; arg = args[i]; i++) {
obj.push({