The express router needs to be developed for the gamelog router api
NOTE: Schemas must also be developed at /dbapi/src/schemas/game.ts. A schema should be created for each use of params, query, or body in the express router
import { Validator } from 'jsonschema';
import { team as schemas } from '../../schemas';
let v: Validator = new Validator();
let result = v.validate(thing, schemas.getTeamParams);
if(result.errors.length > 0) {
return foo('did bad');
}
NOTE: Make sure to add the exported router to /dbapi/src/routers/api/index.ts. Then, if the dbapi/src/routers folder is imported as routers, it can be retrieved as routers.api.game
NOTE: Currently, the gamelog itself is stored in the game table. Endpoints should not return (or even SELECT at the SQL level) for the gamelog column as it will only slow things down. Add seperate endpoints for adding and getting gamelogs
Endpoints
[ ] GET /api/v2/game/:id/
Get a game based on id. Should not select for gamelog column
file:
/dbapi/src/routers/api/game.ts
The express router needs to be developed for the gamelog router api
NOTE: Schemas must also be developed at
/dbapi/src/schemas/game.ts
. A schema should be created for each use of params, query, or body in the express routerNOTE: Make sure to add the exported router to
/dbapi/src/routers/api/index.ts
. Then, if thedbapi/src/routers
folder is imported asrouters
, it can be retrieved asrouters.api.game
NOTE: Currently, the gamelog itself is stored in the
game
table. Endpoints should not return (or even SELECT at the SQL level) for the gamelog column as it will only slow things down. Add seperate endpoints for adding and getting gamelogsEndpoints
GET /api/v2/game/:id/
id
. Should not select forgamelog
columnGET /api/v2/game/:id/gamelog/
id
GET /api/v2/game/
/api/v2/game/?teams=1&teams=2&status=finished
POST /api/v2/game/
gamelog
columnPOST /api/v2/game/:id/
id
, from the request body. Should not acceptgamelog
columnPOST /api/v2/game/:id/gamelog/
id
, from the request body.