Skip to content

Commit b77beb5

Browse files
committed
SBCOSS-409: fixed linting issues
1 parent 4bd658b commit b77beb5

22 files changed

+2015
-2060
lines changed

src/helpers/configHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var orgDataHelper = require('./orgHelper')
1111
* data asynchronously and return back a promise
1212
* @returns promise
1313
*/
14-
function getAllChannelsFromAPI() {
14+
function getAllChannelsFromAPI () {
1515
return new Promise(function (resolve, reject) {
1616
var limit = 200
1717
var offset = 0

src/helpers/licenseHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function includeLicenseDetails (req, res, cb) {
1919
let contents = inputContentIsArray ? res.result.content : [res.result.content]
2020
if (_.size(fieldsToPopulate) && _.size(contents)) {
2121
populateLicenseDetailsByName(contents, fieldsToPopulate, function
22-
(err, contentWithLicenseDetails) {
22+
(err, contentWithLicenseDetails) {
2323
if (!err) {
2424
res.result.content = inputContentIsArray ? contentWithLicenseDetails : contentWithLicenseDetails[0]
2525
}

src/helpers/orgHelper.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var async = require('async')
1414
* @param requestObj js object which contains the search request with filters,offset,limit,query etc
1515
* @param cb callback after success or error
1616
*/
17-
function getRootOrgs(requestObj, cb, noExitOnError) {
17+
function getRootOrgs (requestObj, cb, noExitOnError) {
1818
logger.debug({ msg: 'getRootOrgs() called', additionalInfo: { requestObj } })
1919
contentProvider.getAllRootOrgs(requestObj, (err, res) => {
2020
if (!err) {
@@ -43,7 +43,7 @@ function getRootOrgs(requestObj, cb, noExitOnError) {
4343
inputdata is array of contents that needs org data
4444
* @param CBW callback after success or error
4545
*/
46-
function getRootOrgsFromCache(orgfetchquery, tryfromcache, inputdata, cb) {
46+
function getRootOrgsFromCache (orgfetchquery, tryfromcache, inputdata, cb) {
4747
async.waterfall([
4848
function (CBW) {
4949
if (tryfromcache) {
@@ -82,7 +82,7 @@ function getRootOrgsFromCache(orgfetchquery, tryfromcache, inputdata, cb) {
8282
])
8383
}
8484

85-
function insertDataToCache(cacheinputdata) {
85+
function insertDataToCache (cacheinputdata) {
8686
cacheManager.mset({ data: cacheinputdata, ttl: configData.orgCacheExpiryTime }, function (err, data) {
8787
if (err) {
8888
logger.error({ msg: 'Caching allRootOrgs data failed', err, additionalInfo: { data: cacheinputdata } })
@@ -97,7 +97,7 @@ function insertDataToCache(cacheinputdata) {
9797
* @param inputdata is array of objects, it might be content or course
9898
* @param cb callback after success or error
9999
*/
100-
function populateOrgDetailsByHasTag(contents, inputfields, cb) {
100+
function populateOrgDetailsByHasTag (contents, inputfields, cb) {
101101
var orgDetails = []
102102
var orgFetchQuery = {
103103
'request': {
@@ -168,7 +168,7 @@ function populateOrgDetailsByHasTag(contents, inputfields, cb) {
168168
* @param inputdata is req object and res object
169169
* @param cb there will be no error callback , always returns success
170170
*/
171-
function includeOrgDetails(req, res, cb) {
171+
function includeOrgDetails (req, res, cb) {
172172
if (_.get(req, 'query.orgdetails') && _.get(res, 'result.content')) {
173173
var inputfields = req.query.orgdetails.split(',')
174174
var fieldsToPopulate = configData.orgfieldsAllowedToSend.filter(eachfield => inputfields.includes(eachfield))
@@ -177,7 +177,7 @@ function includeOrgDetails(req, res, cb) {
177177
var contents = inputContentIsArray ? res.result.content : [res.result.content]
178178
if (_.size(fieldsToPopulate) && _.size(contents)) {
179179
populateOrgDetailsByHasTag(contents, fieldsToPopulate, function
180-
(err, contentwithorgdetails) {
180+
(err, contentwithorgdetails) {
181181
if (!err) {
182182
res.result.content = inputContentIsArray ? contentwithorgdetails : contentwithorgdetails[0]
183183
}
@@ -192,7 +192,7 @@ function includeOrgDetails(req, res, cb) {
192192
}
193193

194194
// prepares the set data for inserting in cache
195-
function prepareCacheDataToInsert(data) {
195+
function prepareCacheDataToInsert (data) {
196196
var cacheKeyValuePairs = []
197197
_.forEach(data, function (eachdata) {
198198
if (eachdata.hashTagId) {
@@ -205,7 +205,7 @@ function prepareCacheDataToInsert(data) {
205205
}
206206

207207
// prepares the get data for fetching from cache
208-
function getKeyNames(data) {
208+
function getKeyNames (data) {
209209
var keyNames = []
210210
_.forEach(data, function (eachdata) {
211211
if (eachdata.channel) {

src/service/conceptService.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var responseCode = messageUtils.RESPONSE_CODE
2121
* @param {Object} req
2222
* @param {Object} response
2323
*/
24-
function getDomainsAPI(req, response) {
24+
function getDomainsAPI (req, response) {
2525
logger.debug({ msg: 'conceptService.getDomainAPI() called' }, req)
2626
var data = {}
2727
var rspObj = req.rspObj
@@ -67,7 +67,7 @@ function getDomainsAPI(req, response) {
6767
* @param {Object} req
6868
* @param {Object} response
6969
*/
70-
function getDomainByIDAPI(req, response) {
70+
function getDomainByIDAPI (req, response) {
7171
logger.debug({ msg: 'conceptService.getDomainByIDAPI() called' }, req)
7272
var data = {}
7373
var rspObj = req.rspObj
@@ -130,7 +130,7 @@ function getDomainByIDAPI(req, response) {
130130
* @param {Object} req
131131
* @param {Object} response
132132
*/
133-
function getObjectTypesAPI(req, response) {
133+
function getObjectTypesAPI (req, response) {
134134
logger.debug({ msg: 'conceptService.getObjectTypesAPI() called' }, req)
135135
var data = {}
136136
var rspObj = req.rspObj
@@ -192,7 +192,7 @@ function getObjectTypesAPI(req, response) {
192192
* @param {Object} req
193193
* @param {Object} response
194194
*/
195-
function getObjectTypeByIDAPI(req, response) {
195+
function getObjectTypeByIDAPI (req, response) {
196196
logger.debug({ msg: 'conceptService.getObjectTypeByIDAPI() called' }, req)
197197
var data = {}
198198
var rspObj = req.rspObj
@@ -257,7 +257,7 @@ function getObjectTypeByIDAPI(req, response) {
257257
* @param {Object} req
258258
* @param {Object} response
259259
*/
260-
function getConceptByIdAPI(req, response) {
260+
function getConceptByIdAPI (req, response) {
261261
logger.debug({ msg: 'conceptService.getConceptByIdAPI() called' }, req)
262262
var data = {}
263263
var rspObj = req.rspObj
@@ -319,7 +319,7 @@ function getConceptByIdAPI(req, response) {
319319
* @param {Object} req
320320
* @param {Object} response
321321
*/
322-
function searchObjectTypeAPI(req, response) {
322+
function searchObjectTypeAPI (req, response) {
323323
logger.debug({ msg: 'conceptService.searchObjectTypeAPI() called' }, req)
324324
var rspObj = req.rspObj
325325
var data = req.body
@@ -387,7 +387,7 @@ function searchObjectTypeAPI(req, response) {
387387
* @param {Object} req
388388
* @param {Object} response
389389
*/
390-
function createObjectTypeAPI(req, response) {
390+
function createObjectTypeAPI (req, response) {
391391
var rspObj = req.rspObj
392392
logger.debug({ msg: 'conceptService.createObjectTypeAPI() called' }, req)
393393
var data = req.body
@@ -454,7 +454,7 @@ function createObjectTypeAPI(req, response) {
454454
* @param {Object} req
455455
* @param {Object} response
456456
*/
457-
function updateObjectTypeAPI(req, response) {
457+
function updateObjectTypeAPI (req, response) {
458458
logger.debug({ msg: 'conceptService.updateObjectTypeAPI() called' }, req)
459459
var rspObj = req.rspObj
460460
var data = req.body
@@ -523,7 +523,7 @@ function updateObjectTypeAPI(req, response) {
523523
* @param {Object} req
524524
* @param {Object} response
525525
*/
526-
function retireObjectTypeAPI(req, response) {
526+
function retireObjectTypeAPI (req, response) {
527527
logger.debug({ msg: 'conceptService.retireObjectTypeAPI() called' }, req)
528528
var rspObj = req.rspObj
529529
var data = req.body
@@ -590,7 +590,7 @@ function retireObjectTypeAPI(req, response) {
590590
* @param {Object} req
591591
* @param {Object} response
592592
*/
593-
function listTermsAPI(req, response) {
593+
function listTermsAPI (req, response) {
594594
logger.debug({ msg: 'conceptService.listTermsAPI() called' }, req)
595595
var rspObj = req.rspObj
596596
async.waterfall([
@@ -616,7 +616,7 @@ function listTermsAPI(req, response) {
616616
* @param {Object} req
617617
* @param {Object} response
618618
*/
619-
function listResourceBundlesAPI(req, response) {
619+
function listResourceBundlesAPI (req, response) {
620620
logger.debug({ msg: 'conceptService.listResourceBundlesAPI() called' }, req)
621621
var rspObj = req.rspObj
622622
async.waterfall([
@@ -642,7 +642,7 @@ function listResourceBundlesAPI(req, response) {
642642
* @param {Object} req
643643
* @param {Object} response
644644
*/
645-
function listOrdinalsAPI(req, response) {
645+
function listOrdinalsAPI (req, response) {
646646
logger.debug({ msg: 'conceptService.listOrdinalsAPI() called' }, req)
647647
var rspObj = req.rspObj
648648
async.waterfall([

src/service/contentService.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,8 +1750,8 @@ function copyContentAPI (req, response) {
17501750
data.contentId = req.params.contentId
17511751
var rspObj = req.rspObj
17521752
var query = {}
1753-
if (req.query){
1754-
query = req.query;
1753+
if (req.query) {
1754+
query = req.query
17551755
}
17561756

17571757
logger.debug({
@@ -1908,7 +1908,7 @@ function searchPluginsAPI (req, response, objectType) {
19081908
function validateContentLock (req, response) {
19091909
var rspObj = req.rspObj
19101910
var userId = req.get('x-authenticated-userid')
1911-
var isRootOrgAdmin = lodash.has(req.body.request, "isRootOrgAdmin") ? req.body.request.isRootOrgAdmin : false
1911+
var isRootOrgAdmin = lodash.has(req.body.request, 'isRootOrgAdmin') ? req.body.request.isRootOrgAdmin : false
19121912
logger.debug({ msg: 'contentService.validateContentLock() called', additionalInfo: { rspObj } }, req)
19131913
var qs = {
19141914
mode: 'edit'

src/service/dataExhaustService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var responseCode = messageUtils.RESPONSE_CODE
2121
* @param {object} req
2222
* @param {object} response
2323
*/
24-
function submitDataSetRequest(req, response) {
24+
function submitDataSetRequest (req, response) {
2525
var data = req.body
2626
var rspObj = req.rspObj
2727

@@ -53,7 +53,7 @@ function submitDataSetRequest(req, response) {
5353
* @param {object} req
5454
* @param {object} response
5555
*/
56-
function getListOfDataSetRequest(req, response) {
56+
function getListOfDataSetRequest (req, response) {
5757
var query = req.query
5858
var rspObj = req.rspObj
5959
var clientKey = req.params.clientKey
@@ -93,7 +93,7 @@ function getListOfDataSetRequest(req, response) {
9393
* @param {object} req
9494
* @param {object} response
9595
*/
96-
function getDataSetDetailRequest(req, response) {
96+
function getDataSetDetailRequest (req, response) {
9797
var rspObj = req.rspObj
9898
var clientKey = req.params.clientKey
9999
var requestId = req.params.requestId
@@ -132,7 +132,7 @@ function getDataSetDetailRequest(req, response) {
132132
* @param {object} req
133133
* @param {object} response
134134
*/
135-
function getChannelDataSetRequest(req, response) {
135+
function getChannelDataSetRequest (req, response) {
136136
var query = req.query
137137
var rspObj = req.rspObj
138138
var dataSetId = req.params.dataSetId

src/service/dialCode/batchImageService.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ var batchModelProperties = ['processid', 'dialcodes', 'config', 'status', 'chann
1616
var KafkaService = require('./../../helpers/qrCodeKafkaProducer.js')
1717

1818
const defaultConfig = {
19-
"errorCorrectionLevel": "H",
20-
"pixelsPerBlock": 2,
21-
"qrCodeMargin": 3,
22-
"textFontName": "Verdana",
23-
"textFontSize": 11,
24-
"textCharacterSpacing": 0.1,
25-
"imageFormat": "png",
26-
"colourModel": "Grayscale",
27-
"imageBorderSize": 1
19+
'errorCorrectionLevel': 'H',
20+
'pixelsPerBlock': 2,
21+
'qrCodeMargin': 3,
22+
'textFontName': 'Verdana',
23+
'textFontSize': 11,
24+
'textCharacterSpacing': 0.1,
25+
'imageFormat': 'png',
26+
'colourModel': 'Grayscale',
27+
'imageBorderSize': 1
2828
}
2929

30-
function BatchImageService(config) {
31-
this.config = _.merge(defaultConfig, config);
30+
function BatchImageService (config) {
31+
this.config = _.merge(defaultConfig, config)
3232
}
3333

3434
BatchImageService.prototype.createRequest = function (data, channel, publisher, rspObj, callback) {
3535
var processId = dbModel.uuid()
36-
var dialcodes = _.map(data.dialcodes, 'text');
36+
var dialcodes = _.map(data.dialcodes, 'text')
3737
// Below line added for ignore eslint camel case issue.
3838
/* eslint new-cap: ["error", { "newIsCap": false }] */
3939
var batch = new dbModel.instance.dialcode_batch({
@@ -60,7 +60,7 @@ BatchImageService.prototype.createRequest = function (data, channel, publisher,
6060
logger.error({ msg: 'Error while inserting record', error })
6161
callback(error, null)
6262
} else {
63-
data.processId = processId;
63+
data.processId = processId
6464
KafkaService.sendRecord(data, function (err, res) {
6565
if (err) {
6666
logger.error({ msg: 'Error while sending record to kafka', err, additionalInfo: { data } })
@@ -69,8 +69,7 @@ BatchImageService.prototype.createRequest = function (data, channel, publisher,
6969
callback(null, processId)
7070
}
7171
})
72-
//TODO: Send to Kafka
73-
72+
// TODO: Send to Kafka
7473
}
7574
})
7675
}
@@ -79,5 +78,4 @@ BatchImageService.prototype.configToString = function () {
7978
return _.mapValues(this.config, _.method('toString'))
8079
}
8180

82-
8381
module.exports = BatchImageService

src/service/dialCode/dialCodeServiceHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var logger = require('sb_logger_util_v2')
1111

1212
// Logic to get the dialcodes for request count
1313

14-
function DialCodeServiceHelper() { }
14+
function DialCodeServiceHelper () { }
1515

1616
DialCodeServiceHelper.prototype.generateDialcodes = function (req, headers, callback) {
1717
this.totalCount = req.request.dialcodes.count > dialcodeMaxCount ? dialcodeMaxCount : req.request.dialcodes.count

src/service/dialCode/imageService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ var _ = require('lodash')
22
var logger = require('sb_logger_util_v2')
33
var dbModel = require('./../../utils/cassandraUtil').getConnections('dialcodes')
44

5-
function ImageService(config) {
5+
function ImageService (config) {
66
this.config = config
77
}
88

9-
ImageService.prototype.getImage = function generateImage(dialcode, channel, publisher, cb) {
9+
ImageService.prototype.getImage = function generateImage (dialcode, channel, publisher, cb) {
1010
var self = this
1111
this.getImgFromDB(dialcode, channel, publisher, function (error, images) {
1212
var image = compareImageConfig(images, self.configToString())

src/service/dialCodeService.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,12 @@ function prepareQRCodeRequestData (dialcodes, config, channel, publisher, conten
5454
} else {
5555
_.forIn(dialcodes, function (index, dialcode) {
5656
tasks[dialcode] = function (callback) {
57-
var fileName = index + '_' + dialcode;
57+
var fileName = index + '_' + dialcode
5858
imageService.insertImg(dialcode, channel, publisher, fileName, callback)
5959
}
6060
})
6161
}
6262

63-
6463
async.parallelLimit(tasks, 100, function (err, results) {
6564
if (err) {
6665
cb(err)
@@ -83,8 +82,8 @@ function prepareQRCodeRequestData (dialcodes, config, channel, publisher, conten
8382

8483
// if content id present then we will send zip file name
8584
if (contentId) {
86-
data['storage']['fileName'] = contentId + '_' + Date.now();
87-
cb(null, data);
85+
data['storage']['fileName'] = contentId + '_' + Date.now()
86+
cb(null, data)
8887
} else {
8988
logger.warn({ msg: 'contentId not present', additionalInfo: { data } })
9089
cb(null, data)
@@ -389,7 +388,7 @@ function updateDialCodeV2API (req, response) {
389388
* @returns {object} return response object with http status
390389
*/
391390
function getDialCodeAPI (req, response) {
392-
logger.info("dialCodeService.js:: getDialCodeAPI function invoked!")
391+
logger.info('dialCodeService.js:: getDialCodeAPI function invoked!')
393392
var data = {}
394393
data.body = req.body
395394
data.dialCodeId = _.get(req, 'body.request.dialcode.identifier')
@@ -465,7 +464,7 @@ function getDialCodeAPI (req, response) {
465464
* @returns {object} return response object with http status
466465
*/
467466
function getDialCodeV2API (req, response) {
468-
logger.info("dialCodeService.js:: getDialCodeV2API function invoked!")
467+
logger.info('dialCodeService.js:: getDialCodeV2API function invoked!')
469468
var data = {}
470469
data.dialCodeId = req.params.dialCodeId
471470
var rspObj = req.rspObj

0 commit comments

Comments
 (0)