Skip to content

Commit 89db18b

Browse files
committed
SBCOSS-399: applied linting for all files
1 parent d87207a commit 89db18b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1891
-1900
lines changed

app.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ const express = require('express');
22
const path = require('path');
33
const cookieParser = require('cookie-parser');
44
const logger = require('morgan');
5-
var debug = require('debug')('report-service:server');
5+
const debug = require('debug')('report-service:server');
6+
7+
const mountRoutes = require('./routes');
68

7-
const mountRoutes = require('./routes')
89
const app = express();
910
const { sequelize } = require('./models');
1011
const { printEnvVariablesStatus } = require('./helpers/envHelpers');
@@ -15,18 +16,18 @@ app.use(express.urlencoded({ extended: false, limit: '1mb' }));
1516
app.use(cookieParser());
1617
app.use(express.static(path.join(__dirname, 'public')));
1718

18-
//connect to the database and mount routes
19+
// connect to the database and mount routes
1920
(async () => {
20-
try {
21-
printEnvVariablesStatus();
22-
await sequelize.authenticate();
23-
// await sequelize.sync();
24-
debug('Connected to the database');
25-
mountRoutes(app);
26-
} catch (error) {
27-
debug('Unable to connect to database', error);
28-
process.exit(1);
29-
}
30-
})()
21+
try {
22+
printEnvVariablesStatus();
23+
await sequelize.authenticate();
24+
// await sequelize.sync();
25+
debug('Connected to the database');
26+
mountRoutes(app);
27+
} catch (error) {
28+
debug('Unable to connect to database', error);
29+
process.exit(1);
30+
}
31+
})();
3132

3233
module.exports = app;

controllers/accessPaths/block.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user block location
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'block',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
12-
const userProfileLocation = _.get(user, 'profileLocation') || _.get(user, 'userLocations');
13-
if (!userProfileLocation) return false;
14-
if (!Array.isArray(userProfileLocation)) return false;
15-
const userBlock = _.find(userProfileLocation, location => _.get(location, 'type') === 'block');
16-
if (!(userBlock && ('id' in userBlock))) return false;
17-
return _.some(payload, locationId => locationId === userBlock.id);
18-
}
19-
}
9+
ruleName: 'block',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
12+
const userProfileLocation = _.get(user, 'profileLocation') || _.get(user, 'userLocations');
13+
if (!userProfileLocation) return false;
14+
if (!Array.isArray(userProfileLocation)) return false;
15+
const userBlock = _.find(userProfileLocation, (location) => _.get(location, 'type') === 'block');
16+
if (!(userBlock && ('id' in userBlock))) return false;
17+
return _.some(payload, (locationId) => locationId === userBlock.id);
18+
},
19+
};

controllers/accessPaths/board.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user's board
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'board',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
12-
const userBoards = _.get(user, 'framework.board');
13-
if (!userBoards) return false;
14-
if (!Array.isArray(userBoards)) return false;
15-
return _.some(payload, board => {
16-
board = _.toLower(board);
17-
if (_.find(userBoards, userBoard => _.toLower(userBoard) === board)) {
18-
return true;
19-
}
9+
ruleName: 'board',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
12+
const userBoards = _.get(user, 'framework.board');
13+
if (!userBoards) return false;
14+
if (!Array.isArray(userBoards)) return false;
15+
return _.some(payload, (board) => {
16+
board = _.toLower(board);
17+
if (_.find(userBoards, (userBoard) => _.toLower(userBoard) === board)) {
18+
return true;
19+
}
2020

21-
return false;
22-
});
23-
}
24-
}
21+
return false;
22+
});
23+
},
24+
};

controllers/accessPaths/channel.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user's channel
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'channel',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
12-
const userChannelId = _.get(user, 'rootOrg.hashTagId') || _.get(user, 'rootOrg.channel') || _.get(user, 'channel');
13-
if (!userChannelId) return false;
14-
return _.some(payload, channel => channel === userChannelId);
15-
}
16-
}
9+
ruleName: 'channel',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
12+
const userChannelId = _.get(user, 'rootOrg.hashTagId') || _.get(user, 'rootOrg.channel') || _.get(user, 'channel');
13+
if (!userChannelId) return false;
14+
return _.some(payload, (channel) => channel === userChannelId);
15+
},
16+
};

controllers/accessPaths/district.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user's district location
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'district',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
12-
const userProfileLocation = _.get(user, 'profileLocation') || _.get(user, 'userLocations');
13-
if (!userProfileLocation) return false;
14-
if (!Array.isArray(userProfileLocation)) return false;
15-
const userDistrict = _.find(userProfileLocation, location => _.get(location, 'type') === 'district');
16-
if (!(userDistrict && ('id' in userDistrict))) return false;
17-
return _.some(payload, locationId => locationId === userDistrict.id);
18-
}
19-
}
9+
ruleName: 'district',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
12+
const userProfileLocation = _.get(user, 'profileLocation') || _.get(user, 'userLocations');
13+
if (!userProfileLocation) return false;
14+
if (!Array.isArray(userProfileLocation)) return false;
15+
const userDistrict = _.find(userProfileLocation, (location) => _.get(location, 'type') === 'district');
16+
if (!(userDistrict && ('id' in userDistrict))) return false;
17+
return _.some(payload, (locationId) => locationId === userDistrict.id);
18+
},
19+
};

controllers/accessPaths/framework.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user's framework
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'framework',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
9+
ruleName: 'framework',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
1212

13-
const frameworkIds = _.get(user, 'framework.id');
14-
if (!frameworkIds) return false;
15-
if (!Array.isArray(frameworkIds)) return false;
13+
const frameworkIds = _.get(user, 'framework.id');
14+
if (!frameworkIds) return false;
15+
if (!Array.isArray(frameworkIds)) return false;
1616

17-
return _.some(payload, frameworkId => {
18-
if (_.find(frameworkIds, id => id === frameworkId)) {
19-
return true;
20-
}
17+
return _.some(payload, (frameworkId) => {
18+
if (_.find(frameworkIds, (id) => id === frameworkId)) {
19+
return true;
20+
}
2121

22-
return false;
23-
});
24-
}
25-
}
22+
return false;
23+
});
24+
},
25+
};

controllers/accessPaths/gradeLevel.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ const _ = require('lodash');
22

33
/**
44
* @description accesspath rule definition for user's gradeLevel
5-
*
5+
*
66
*/
77

88
module.exports = {
9-
ruleName: 'gradeLevel',
10-
isMatch(user, payload) {
11-
payload = Array.isArray(payload) ? payload : [payload];
12-
const userGradeLevels = _.get(user, 'framework.gradeLevel');
13-
if (!userGradeLevels) return false;
14-
if (!Array.isArray(userGradeLevels)) return false;
15-
return _.some(payload, gradeLevel => {
16-
gradeLevel = _.toLower(gradeLevel);
17-
if (_.find(userGradeLevels, userGradeLevel => _.toLower(userGradeLevel) === gradeLevel)) {
18-
return true;
19-
}
9+
ruleName: 'gradeLevel',
10+
isMatch(user, payload) {
11+
payload = Array.isArray(payload) ? payload : [payload];
12+
const userGradeLevels = _.get(user, 'framework.gradeLevel');
13+
if (!userGradeLevels) return false;
14+
if (!Array.isArray(userGradeLevels)) return false;
15+
return _.some(payload, (gradeLevel) => {
16+
gradeLevel = _.toLower(gradeLevel);
17+
if (_.find(userGradeLevels, (userGradeLevel) => _.toLower(userGradeLevel) === gradeLevel)) {
18+
return true;
19+
}
2020

21-
return false;
22-
});
23-
}
24-
}
21+
return false;
22+
});
23+
},
24+
};

0 commit comments

Comments
 (0)