(req, res)
| 70 | } |
| 71 | |
| 72 | const getPPAByGame = async (req, res) => { |
| 73 | try { |
| 74 | if (!req.query.year) { |
| 75 | res.status(400).send({ |
| 76 | error: 'year must be specified' |
| 77 | }); |
| 78 | } else if (req.query.year && !parseInt(req.query.year)) { |
| 79 | res.status(400).send({ |
| 80 | error: 'year must be numeric' |
| 81 | }); |
| 82 | } else if (req.query.week && !parseInt(req.query.week)) { |
| 83 | res.status(400).send({ |
| 84 | error: 'week must be numeric' |
| 85 | }); |
| 86 | } else if (req.query.seasonType && req.query.seasonType != 'regular' && req.query.seasonType != 'postseason' && req.query.seasonType != 'both') { |
| 87 | res.status(400).send({ |
| 88 | error: 'Invalid season type' |
| 89 | }); |
| 90 | } else { |
| 91 | const results = await service.getPPAByGame(req.query.year, req.query.team, req.query.conference, req.query.week, req.query.excludeGarbageTime, req.query.seasonType); |
| 92 | res.send(results); |
| 93 | } |
| 94 | } catch (err) { |
| 95 | Sentry.captureException(err); |
| 96 | res.status(500).send({ |
| 97 | error: 'Something went wrong.' |
| 98 | }); |
| 99 | } |
| 100 | }; |
| 101 | |
| 102 | const getPPAByPlayerGame = async (req, res) => { |
| 103 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected