Skip to content

Commit ac5ee60

Browse files
committed
[api] small refactor scan service
1 parent 2271d4a commit ac5ee60

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/controllers/result_controllers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ module.exports = {
1818
async store(req, res) {
1919
const repo = { repositoryName: req.body.repoName };
2020

21-
const scannedRepo = scan(repo);
2221
let result = {};
2322
try {
23+
const scannedRepo = scan.getResults(repo);
2424
result = await Result.create(scannedRepo);
2525
} catch (e) {
2626
logger.error(e);

api/services/scan.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const sample_finding = {
2626
},
2727
};
2828

29-
const scan = repo => ({ ...repo, ...populateResultEntity() });
29+
const getResults = repo => ({ ...repo, ...populateResultEntity() });
3030

3131
const populateResultEntity = () => attributeDataFromStatus(chooseRandomStatus());
3232

@@ -64,4 +64,4 @@ const attributeFindings = (max = 5) => {
6464
return findings;
6565
};
6666

67-
module.exports = scan;
67+
module.exports = Object.assign({}, { getResults });

0 commit comments

Comments
 (0)