gRPC HTTP repo for https://api.thesammy2010.com
make install
make run-app
Good Create Squash Player request
POST /v1/squash/players?pretty
Content-Type: application/json
{"name": "TheSammy2010", "email_address": "[email protected]"}
{
"id": "a715ea87-92e2-4a11-80cf-7a9f9f2d9302"
}
Bad Create Squash Player request
POST /v1/squash/players?pretty
Content-Type: application/json
{"name": ""}
{
"code": 9,
"message": "Player `name` is required",
"details": []
}
Good Get squash player request
GET /v1/squash/players/76d34b99-1e10-4693-b2c2-20b129ad4da1
Content-Type: application/json
{
"squashPlayer": {
"id": "6622224b-a8eb-4093-bc24-4c8a20f49f25",
"name": "TheSammy2010",
"email_address": "[email protected]",
"profile_picture": "",
"created_at": "2024-01-25T00:58:28.819889Z",
"updated_at": "2024-01-25T00:58:28.819889Z"
}
}
Bad Get squash player request
GET /v1/squash/players/76d34b99-1e10-4693-b2c2-20b129ad4da1
Content-Type: application/json
{
"code": 3,
"message": "Player `id` type is not valid UUID",
"details": []
}
PATCH /v1/squash/players/76d34b99-1e10-4693-b2c2-20b129ad4da1 -d '{"name": "TheSammy2011"}'
{
"squashPlayer": {
"id": "76d34b99-1e10-4693-b2c2-20b129ad4da1",
"name": "TheSammy2011",
"email_address": "[email protected]",
"profile_picture": "",
"created_at": "2024-02-05T14:34:41Z",
"updated_at": "2024-02-05T15:34:44Z"
}
}
TODO
- Authentication
- via Google
- RBAC https://mikebolshakov.medium.com/custom-role-based-authorization-in-golang-ba6d5585a521
- Authorised users can view
- Whitelisted users can create and edit games
- Admin can delete games
- Routes & Methods
-
/v1/squash/players/signup
-
/v1/squash/players
- GET
- GET (list)
- POST (create) //Deprecated in place of
/v1/squash/players/signup
- PATCH (update)
- DELETE
-
/v1/squash/games/singles
- GET
- GET (list)
- POST (create)
- PATCH (update)
- DELETE
-
/v1/squash/games/doubles
- GET
- GET (list)
- POST (create)
- PATCH (update)
- DELETE
-
- Postgres Setup in Code
- ORM relationships between tables
- Handle null fields
- Handle timestamps
- Logging
- Trace Logging
- Handle non-registered routes