(req, res)
| 68 | * @todo create cache for RDS usernames <> github usernames |
| 69 | */ |
| 70 | const getOpenPRs = async (req, res) => { |
| 71 | try { |
| 72 | const order = ORDER_TYPE.DESC; |
| 73 | const { size, page } = req.query; |
| 74 | const { data } = await githubService.fetchOpenPRs({ perPage: size, page, resultOptions: { order } }); |
| 75 | |
| 76 | if (data.total_count) { |
| 77 | const allPRs = githubService.extractPRdetails(data); |
| 78 | return res.json({ |
| 79 | message: "Open PRs", |
| 80 | pullRequests: allPRs, |
| 81 | }); |
| 82 | } |
| 83 | return res.json({ |
| 84 | message: "No pull requests found!", |
| 85 | pullRequests: [], |
| 86 | }); |
| 87 | } catch (err) { |
| 88 | logger.error(`Error while processing pull requests: ${err}`); |
| 89 | return res.boom.badImplementation(SOMETHING_WENT_WRONG); |
| 90 | } |
| 91 | }; |
| 92 | |
| 93 | module.exports = { |
| 94 | getUserPRs, |
nothing calls this directly
no outgoing calls
no test coverage detected