(req, res)
| 4 | const service = playerService(db); |
| 5 | |
| 6 | const playerSearch = async (req, res) => { |
| 7 | try { |
| 8 | if (!req.query.searchTerm) { |
| 9 | res.status(400).send({ |
| 10 | error: 'searchTerm must be specified' |
| 11 | }); |
| 12 | } else if (req.query.year && !parseInt(req.query.year)) { |
| 13 | res.status(400).send({ |
| 14 | error: 'year must be an integer' |
| 15 | }); |
| 16 | }else { |
| 17 | let results = await service.playerSearch(req.query.year, req.query.team, req.query.position, req.query.searchTerm); |
| 18 | res.send(results); |
| 19 | } |
| 20 | } catch (err) { |
| 21 | Sentry.captureException(err); |
| 22 | res.status(500).send({ |
| 23 | error: 'Something went wrong.' |
| 24 | }); |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | const getMeanPassingPPA = async (req, res) => { |
| 29 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected