* feat: remove eslint-plugin-prettier for prettier This removes the annoying lint warnings when all that needs to change is formatting * fix: use .js lint-staged config to ignore properly * fix: lint everything if a lot of files are changed It's faster than making lots of individual linter calls * chore: apply prettier * fix: ignore code in curriculum-file-structure
21 lines
610 B
JavaScript
21 lines
610 B
JavaScript
const router = require('express').Router();
|
|
const { ALL_REPOS } = require('../models');
|
|
const { reqLimiter } = require('../req-limiter');
|
|
|
|
router.get('/', reqLimiter, async (request, response) => {
|
|
let allRepos = await ALL_REPOS.find({}).then((data) => data);
|
|
allRepos.sort((a, b) => a._id - b._id);
|
|
allRepos = allRepos.reduce((allReposArr, aRepo) => {
|
|
const { _id, prs } = aRepo;
|
|
if (prs.length) {
|
|
prs.sort((a, b) => a._id - b._id);
|
|
return allReposArr.concat({ _id, prs });
|
|
}
|
|
return allRepos;
|
|
}, []);
|
|
|
|
response.json({ ok: true, allRepos });
|
|
});
|
|
|
|
module.exports = router;
|