MCPcopy Create free account
hub / github.com/CFBD/cfb-api / playerSearch

Function playerSearch

app/player/player.controller.js:6–26  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected