Fix code style

pull/34/head
HardiReady 2018-04-29 09:51:28 +02:00
parent da29c39b88
commit 0bf730e0d4
5 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,7 @@
###-------------------------------------------------------------### ###-------------------------------------------------------------###
###------------------- HOW TO USE THIS FILE --------------------### ###------------------- HOW TO USE THIS FILE --------------------###
###-------------------------------------------------------------### ###-------------------------------------------------------------###
### 1. start express server with `npm run start-test` ### ### 1. start express server with `npm run start-api-test` ###
### 2. import data by executing script: `./populate-data.sh` ### ### 2. import data by executing script: `./populate-data.sh` ###
### 3. change data in app as you need for tests ### ### 3. change data in app as you need for tests ###
### 4. export data state with: `./populate-data.sh -m save` ### ### 4. export data state with: `./populate-data.sh -m save` ###

View File

@ -66,14 +66,14 @@ campaigns.route('/:id')
} }
req.body.updatedAt = new Date(); req.body.updatedAt = new Date();
req.body.$inc = { __v: 1 }; req.body.$inc = {__v: 1};
if (req.body.hasOwnProperty('__v')) { if (req.body.hasOwnProperty('__v')) {
delete req.body.__v; delete req.body.__v;
} }
// PATCH is easier with mongoose than PUT. You simply update by all data that comes from outside. no need to // 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. // reset attributes that are missing.
CampaignModel.findByIdAndUpdate(req.params.id, req.body, { new: true }, (err, item) => { CampaignModel.findByIdAndUpdate(req.params.id, req.body, {new: true}, (err, item) => {
if (err) { if (err) {
err.status = codes.wrongrequest; err.status = codes.wrongrequest;
} else if (!item) { } else if (!item) {
@ -96,7 +96,7 @@ campaigns.route('/:id')
err.status = codes.notfound; err.status = codes.notfound;
return next(err); return next(err);
} }
WarModel.find({ campaign: req.params.id }).remove().exec(); WarModel.find({campaign: req.params.id}).remove().exec();
// TODO: remove all the war logs from fs here!!! // TODO: remove all the war logs from fs here!!!
res.locals.processed = true; res.locals.processed = true;
next(); next();

View File

@ -1,7 +1,6 @@
<code_scheme name="OPT-CC" version="173"> <code_scheme name="OPT-CC" version="173">
<option name="FORMATTER_TAGS_ENABLED" value="true" /> <option name="FORMATTER_TAGS_ENABLED" value="true" />
<JSCodeStyleSettings> <JSCodeStyleSettings>
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="USE_CHAINED_CALLS_GROUP_INDENTS" value="true" /> <option name="USE_CHAINED_CALLS_GROUP_INDENTS" value="true" />
</JSCodeStyleSettings> </JSCodeStyleSettings>
<TypeScriptCodeStyleSettings> <TypeScriptCodeStyleSettings>

View File

@ -41,7 +41,7 @@ export class CampaignSubmitComponent {
.subscribe(campaign => { .subscribe(campaign => {
let redirectSuccessUrl = '../overview/'; let redirectSuccessUrl = '../overview/';
if (this.campaign._id) { if (this.campaign._id) {
redirectSuccessUrl = '../' + redirectSuccessUrl redirectSuccessUrl = '../' + redirectSuccessUrl;
} }
this.router.navigate([redirectSuccessUrl + campaign._id], {relativeTo: this.route}); this.router.navigate([redirectSuccessUrl + campaign._id], {relativeTo: this.route});
}, },

View File

@ -38,7 +38,7 @@ export class WarSubmitComponent {
fileChange(event) { fileChange(event) {
if (this.validExtensions.filter(ext => event.target.files[0] && if (this.validExtensions.filter(ext => event.target.files[0] &&
event.target.files[0].name.endsWith(ext)).length == 1) { event.target.files[0].name.endsWith(ext)).length === 1) {
this.showFileError = false; this.showFileError = false;
this.fileList = event.target.files; this.fileList = event.target.files;
} else { } else {