Skip to content

Commit

Permalink
Style: return type and map
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderleegs committed Mar 14, 2022
1 parent 63cc4d9 commit 9b05ff7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion newroutes/sites.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SitesRouter {
},
{ userId }
)
return res.status(200).send("OK")
return res.status(200)
}

async getLastUpdated(req, res) {
Expand Down
13 changes: 5 additions & 8 deletions services/utilServices/SitesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const axios = require("axios")
const Bluebird = require("bluebird")
const _ = require("lodash")

// Import error
const GH_MAX_REPO_COUNT = 100
const ISOMERPAGES_REPO_PAGE_COUNT = process.env.ISOMERPAGES_REPO_PAGE_COUNT || 3
const ISOMER_GITHUB_ORG_NAME = process.env.GITHUB_ORG_NAME
Expand Down Expand Up @@ -50,14 +49,13 @@ class SitesService {
const endpoint = `https://api.github.com/orgs/${ISOMER_GITHUB_ORG_NAME}/repos`

// Simultaneously retrieve all isomerpages repos
const paramsArr = []
for (let i = 0; i < ISOMERPAGES_REPO_PAGE_COUNT; i += 1) {
paramsArr.push({
const paramsArr = _.fill(Array(ISOMERPAGES_REPO_PAGE_COUNT), null).map(
(_, idx) => ({
per_page: GH_MAX_REPO_COUNT,
sort: "full_name",
page: i + 1,
page: idx + 1,
})
}
)

const sites = await Bluebird.map(paramsArr, async (params) => {
const resp = await axios.get(endpoint, {
Expand Down Expand Up @@ -91,8 +89,7 @@ class SitesService {
)
})

const flattenedSites = _.flatten(sites)
return flattenedSites
return _.flatten(sites)
}

async checkHasAccess(reqDetails, { userId }) {
Expand Down

0 comments on commit 9b05ff7

Please sign in to comment.