mirror of
https://github.com/nprasad2077/NBA_Go.git
synced 2026-09-22 14:05:13 +00:00
shot chart controller and docs update
This commit is contained in:
@@ -101,6 +101,91 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/playershotchart": {
|
||||
"get": {
|
||||
"description": "Returns a paginated list of shot-chart points, optionally filtered by various parameters.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"PlayerShotChart"
|
||||
],
|
||||
"summary": "Get shot-chart data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Page number for pagination (defaults to 1)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Player ID (e.g., hardeja01)",
|
||||
"name": "playerId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Season (e.g., 2023)",
|
||||
"name": "season",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Game date (e.g., Oct 17, 2018)",
|
||||
"name": "date",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Quarter (e.g., 1st Qtr)",
|
||||
"name": "qtr",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Shot result (true for made, false for missed)",
|
||||
"name": "result",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Shot type (e.g., 2-pointer)",
|
||||
"name": "shot_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Opponent team (e.g., NOP)",
|
||||
"name": "opponent",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.PlayerShotChart"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/playertotals": {
|
||||
"get": {
|
||||
"description": "Filter and paginate player totals",
|
||||
|
||||
@@ -82,3 +82,15 @@ CREATE INDEX IF NOT EXISTS idx_total_stats_player_name_trgm ON public.player_tot
|
||||
With this type of index, queries using `ILIKE '%davis%'` become extremely fast. This is something to keep in mind as you add more features.
|
||||
|
||||
For now, running the standard `CREATE INDEX` commands listed above will give you excellent, comprehensive performance for a wide variety of common queries and sorting operations. You've built a truly robust and high-performance API.
|
||||
|
||||
|
||||
---
|
||||
## Player Shots
|
||||
|
||||
```SQL
|
||||
CREATE INDEX idx_player_season_filters ON public.player_shot_charts (player_id, season, "date", qtr, result, shot_type, opponent);
|
||||
|
||||
CREATE INDEX idx_player_shot_charts_date ON public.player_shot_charts ("date");
|
||||
CREATE INDEX idx_player_shot_charts_opponent ON public.player_shot_charts (opponent);
|
||||
CREATE INDEX idx_player_shot_charts_shot_type ON public.player_shot_charts (shot_type);
|
||||
```
|
||||
@@ -97,6 +97,91 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/playershotchart": {
|
||||
"get": {
|
||||
"description": "Returns a paginated list of shot-chart points, optionally filtered by various parameters.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"PlayerShotChart"
|
||||
],
|
||||
"summary": "Get shot-chart data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Page number for pagination (defaults to 1)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Player ID (e.g., hardeja01)",
|
||||
"name": "playerId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Season (e.g., 2023)",
|
||||
"name": "season",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Game date (e.g., Oct 17, 2018)",
|
||||
"name": "date",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Quarter (e.g., 1st Qtr)",
|
||||
"name": "qtr",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "Shot result (true for made, false for missed)",
|
||||
"name": "result",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Shot type (e.g., 2-pointer)",
|
||||
"name": "shot_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Opponent team (e.g., NOP)",
|
||||
"name": "opponent",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.PlayerShotChart"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/playertotals": {
|
||||
"get": {
|
||||
"description": "Filter and paginate player totals",
|
||||
|
||||
@@ -185,6 +185,63 @@ paths:
|
||||
summary: Get player advanced stats
|
||||
tags:
|
||||
- PlayerStats
|
||||
/api/playershotchart:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a paginated list of shot-chart points, optionally filtered
|
||||
by various parameters.
|
||||
parameters:
|
||||
- description: Page number for pagination (defaults to 1)
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: Player ID (e.g., hardeja01)
|
||||
in: query
|
||||
name: playerId
|
||||
type: string
|
||||
- description: Season (e.g., 2023)
|
||||
in: query
|
||||
name: season
|
||||
type: integer
|
||||
- description: Game date (e.g., Oct 17, 2018)
|
||||
in: query
|
||||
name: date
|
||||
type: string
|
||||
- description: Quarter (e.g., 1st Qtr)
|
||||
in: query
|
||||
name: qtr
|
||||
type: string
|
||||
- description: Shot result (true for made, false for missed)
|
||||
in: query
|
||||
name: result
|
||||
type: boolean
|
||||
- description: Shot type (e.g., 2-pointer)
|
||||
in: query
|
||||
name: shot_type
|
||||
type: string
|
||||
- description: Opponent team (e.g., NOP)
|
||||
in: query
|
||||
name: opponent
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/models.PlayerShotChart'
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get shot-chart data
|
||||
tags:
|
||||
- PlayerShotChart
|
||||
/api/playertotals:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user