Skip to content

Commit b1258e2

Browse files
committed
minor-fixes:
1- remove space in export/index.js 2- remove ressign lines for res & acc
1 parent ee649cf commit b1258e2

File tree

5 files changed

+42
-44
lines changed

5 files changed

+42
-44
lines changed

scripts/data/export/index.js

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,40 @@ function runExportData(filePath, logger) {
2121
process.exit(1);
2222
});
2323
}
24-
const logger = util.getAppLogger();
25-
const filePath =
26-
process.argv[2] === '--file' && process.argv[3]
27-
? process.argv[3]
28-
: 'data/demo-data.json';
29-
logger.info('Script will export data to file:', filePath);
30-
// check if file exists
31-
if (fs.existsSync(filePath)) {
32-
// We delay question for overwrite file, because the question overlaps with a warning message from sequelize module
33-
Promise.delay(1).then(() => {
34-
const rl = readline.createInterface({
35-
input: process.stdin,
36-
output: process.stdout,
37-
});
38-
// confirm overwritting to file
39-
rl.question(
40-
'File already exists, Are you sure to overwrite it? [Y] to overwrite: ',
41-
(answer) => {
42-
rl.close();
43-
if (answer.toLowerCase() === 'y') {
44-
logger.info('File will be overwritten.');
45-
runExportData(filePath, logger);
46-
} else {
47-
logger.info('Exit without exporting any data');
48-
process.exit(0);
49-
}
50-
},
51-
); // question()
24+
25+
const logger = util.getAppLogger();
26+
const filePath =
27+
process.argv[2] === '--file' && process.argv[3]
28+
? process.argv[3]
29+
: 'data/demo-data.json';
30+
logger.info('Script will export data to file:', filePath);
31+
// check if file exists
32+
if (fs.existsSync(filePath)) {
33+
// We delay question for overwrite file, because the question overlaps with a warning message from sequelize module
34+
Promise.delay(1).then(() => {
35+
const rl = readline.createInterface({
36+
input: process.stdin,
37+
output: process.stdout,
5238
});
53-
} else {
54-
// get base directory of the file
55-
const baseDir = path.resolve(filePath, '..');
56-
// create directory recursively if it does not exist
57-
util.mkdirSyncRecursive(baseDir);
58-
runExportData(filePath, logger);
59-
}
39+
// confirm overwritting to file
40+
rl.question(
41+
'File already exists, Are you sure to overwrite it? [Y] to overwrite: ',
42+
(answer) => {
43+
rl.close();
44+
if (answer.toLowerCase() === 'y') {
45+
logger.info('File will be overwritten.');
46+
runExportData(filePath, logger);
47+
} else {
48+
logger.info('Exit without exporting any data');
49+
process.exit(0);
50+
}
51+
},
52+
); // question()
53+
});
54+
} else {
55+
// get base directory of the file
56+
const baseDir = path.resolve(filePath, '..');
57+
// create directory recursively if it does not exist
58+
util.mkdirSyncRecursive(baseDir);
59+
runExportData(filePath, logger);
60+
}

src/middlewares/performanceRequestLogger.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ module.exports = function logRequest(logger) {
1111
}
1212

1313
// Use the logger with memory usage info
14-
return (req, response, next) => {
15-
const res = response;
14+
return (req, res, next) => {
1615
const startOpts = {
1716
method: req.method,
1817
url: req.url,

src/middlewares/validateTimeline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import util from '../util';
77
/**
88
* Common validation code for types of timeline references.
99
* @param {{ reference: string, referenceId: string|number }} sourceObject
10-
* @param {object} request
10+
* @param {object} req
1111
* @param {boolean} [validateProjectExists]
1212
* @returns {Promise}
1313
*/

src/permissions/project.delete.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import { PROJECT_MEMBER_ROLE } from '../constants';
66
/**
77
* Super admin, Topcoder Managers are allowed to edit any project
88
* Rest can add members only if they are currently part of the project team.
9-
* @param {Object} freq the express request instance
9+
* @param {Object} req the express request instance
1010
* @return {Promise} Returns a promise
1111
*/
12-
module.exports = freq => new Promise((resolve, reject) => {
13-
const projectId = _.parseInt(freq.params.projectId);
12+
module.exports = req => new Promise((resolve, reject) => {
13+
const projectId = _.parseInt(req.params.projectId);
1414
return models.ProjectMember.getActiveProjectMembers(projectId)
1515
.then((members) => {
16-
const req = freq;
1716
req.context = req.context || {};
1817
req.context.currentProjectMembers = members;
1918
// check if auth user has acecss to this project

src/util.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,7 @@ _.assignIn(util, {
765765
}
766766

767767
// set default null value for all valid fields
768-
const memberDefaults = _.reduce(fields, (ac, field) => {
769-
const acc = ac;
768+
const memberDefaults = _.reduce(fields, (acc, field) => {
770769
const isValidField = _.includes(_.union(memberDetailFields, memberTraitFields), field);
771770
if (isValidField) {
772771
acc[field] = null;

0 commit comments

Comments
 (0)