diff --git a/docs/docs.go b/docs/docs.go index 47d40df..a34cfd4 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3058,7 +3058,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Fixtures" + "EnetPulse" ], "summary": "Get all stored fixtures", "responses": { @@ -3102,7 +3102,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Fixtures" + "EnetPulse" ], "summary": "Get fixtures with preodds", "responses": { @@ -3146,7 +3146,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Preodds" + "EnetPulse" ], "summary": "Get all preodds", "responses": { @@ -3190,7 +3190,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Results" + "EnetPulse" ], "summary": "Get all results", "responses": { @@ -3234,7 +3234,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Sports" + "EnetPulse" ], "summary": "Get all sports", "responses": { @@ -3278,7 +3278,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Tournament Stages" + "EnetPulse" ], "summary": "Get all tournament stages", "responses": { @@ -3322,7 +3322,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Tournament Templates" + "EnetPulse" ], "summary": "Get all tournament templates", "responses": { @@ -3366,7 +3366,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "EnetPulse - Tournaments" + "EnetPulse" ], "summary": "Get all tournaments", "responses": { @@ -4300,108 +4300,6 @@ const docTemplate = `{ } } }, - "/api/v1/odds/pre-match": { - "get": { - "description": "Fetches pre-match odds from EnetPulse for a given event", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "EnetPulse - PreMatch" - ], - "summary": "Get pre-match odds for an event", - "parameters": [ - { - "type": "integer", - "description": "Event ID", - "name": "objectFK", - "in": "query", - "required": true - }, - { - "type": "array", - "items": { - "type": "integer" - }, - "collectionFormat": "csv", - "description": "Odds provider IDs (comma separated)", - "name": "oddsProviderFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome type ID", - "name": "outcomeTypeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome scope ID", - "name": "outcomeScopeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome subtype ID", - "name": "outcomeSubtypeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Limit results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "Offset results", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "description": "Language type ID", - "name": "languageTypeFK", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.PreMatchOddsResponse" - } - } - } - ] - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/domain.ErrorResponse" - } - }, - "502": { - "description": "Bad Gateway", - "schema": { - "$ref": "#/definitions/domain.ErrorResponse" - } - } - } - } - }, "/api/v1/odds/upcoming/{upcoming_id}": { "get": { "description": "Retrieve prematch odds by upcoming event ID (FI from Bet365) with optional pagination", @@ -12402,41 +12300,6 @@ const docTemplate = `{ } } }, - "domain.PreMatchOddsResponse": { - "type": "object", - "properties": { - "eventFK": { - "description": "Define fields according to the Enetpulse preodds response structure\nExample:", - "type": "integer" - }, - "odds": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.PreMatchOutcome" - } - } - } - }, - "domain.PreMatchOutcome": { - "type": "object", - "properties": { - "oddsProviderFK": { - "type": "integer" - }, - "oddsValue": { - "type": "number" - }, - "outcomeFK": { - "type": "integer" - }, - "outcomeTypeFK": { - "type": "integer" - }, - "outcomeValue": { - "type": "string" - } - } - }, "domain.ProviderRequest": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 252532a..c59c2e1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3050,7 +3050,7 @@ "application/json" ], "tags": [ - "EnetPulse - Fixtures" + "EnetPulse" ], "summary": "Get all stored fixtures", "responses": { @@ -3094,7 +3094,7 @@ "application/json" ], "tags": [ - "EnetPulse - Fixtures" + "EnetPulse" ], "summary": "Get fixtures with preodds", "responses": { @@ -3138,7 +3138,7 @@ "application/json" ], "tags": [ - "EnetPulse - Preodds" + "EnetPulse" ], "summary": "Get all preodds", "responses": { @@ -3182,7 +3182,7 @@ "application/json" ], "tags": [ - "EnetPulse - Results" + "EnetPulse" ], "summary": "Get all results", "responses": { @@ -3226,7 +3226,7 @@ "application/json" ], "tags": [ - "EnetPulse - Sports" + "EnetPulse" ], "summary": "Get all sports", "responses": { @@ -3270,7 +3270,7 @@ "application/json" ], "tags": [ - "EnetPulse - Tournament Stages" + "EnetPulse" ], "summary": "Get all tournament stages", "responses": { @@ -3314,7 +3314,7 @@ "application/json" ], "tags": [ - "EnetPulse - Tournament Templates" + "EnetPulse" ], "summary": "Get all tournament templates", "responses": { @@ -3358,7 +3358,7 @@ "application/json" ], "tags": [ - "EnetPulse - Tournaments" + "EnetPulse" ], "summary": "Get all tournaments", "responses": { @@ -4292,108 +4292,6 @@ } } }, - "/api/v1/odds/pre-match": { - "get": { - "description": "Fetches pre-match odds from EnetPulse for a given event", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "EnetPulse - PreMatch" - ], - "summary": "Get pre-match odds for an event", - "parameters": [ - { - "type": "integer", - "description": "Event ID", - "name": "objectFK", - "in": "query", - "required": true - }, - { - "type": "array", - "items": { - "type": "integer" - }, - "collectionFormat": "csv", - "description": "Odds provider IDs (comma separated)", - "name": "oddsProviderFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome type ID", - "name": "outcomeTypeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome scope ID", - "name": "outcomeScopeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Outcome subtype ID", - "name": "outcomeSubtypeFK", - "in": "query" - }, - { - "type": "integer", - "description": "Limit results", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "Offset results", - "name": "offset", - "in": "query" - }, - { - "type": "integer", - "description": "Language type ID", - "name": "languageTypeFK", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.PreMatchOddsResponse" - } - } - } - ] - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/domain.ErrorResponse" - } - }, - "502": { - "description": "Bad Gateway", - "schema": { - "$ref": "#/definitions/domain.ErrorResponse" - } - } - } - } - }, "/api/v1/odds/upcoming/{upcoming_id}": { "get": { "description": "Retrieve prematch odds by upcoming event ID (FI from Bet365) with optional pagination", @@ -12394,41 +12292,6 @@ } } }, - "domain.PreMatchOddsResponse": { - "type": "object", - "properties": { - "eventFK": { - "description": "Define fields according to the Enetpulse preodds response structure\nExample:", - "type": "integer" - }, - "odds": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.PreMatchOutcome" - } - } - } - }, - "domain.PreMatchOutcome": { - "type": "object", - "properties": { - "oddsProviderFK": { - "type": "integer" - }, - "oddsValue": { - "type": "number" - }, - "outcomeFK": { - "type": "integer" - }, - "outcomeTypeFK": { - "type": "integer" - }, - "outcomeValue": { - "type": "string" - } - } - }, "domain.ProviderRequest": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 2fee177..c6c6fce 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1757,31 +1757,6 @@ definitions: thumbnail: type: string type: object - domain.PreMatchOddsResponse: - properties: - eventFK: - description: |- - Define fields according to the Enetpulse preodds response structure - Example: - type: integer - odds: - items: - $ref: '#/definitions/domain.PreMatchOutcome' - type: array - type: object - domain.PreMatchOutcome: - properties: - oddsProviderFK: - type: integer - oddsValue: - type: number - outcomeFK: - type: integer - outcomeTypeFK: - type: integer - outcomeValue: - type: string - type: object domain.ProviderRequest: properties: brandId: @@ -6186,7 +6161,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all stored fixtures tags: - - EnetPulse - Fixtures + - EnetPulse /api/v1/enetpulse/fixtures/preodds: get: consumes: @@ -6213,7 +6188,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get fixtures with preodds tags: - - EnetPulse - Fixtures + - EnetPulse /api/v1/enetpulse/preodds: get: consumes: @@ -6239,7 +6214,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all preodds tags: - - EnetPulse - Preodds + - EnetPulse /api/v1/enetpulse/results: get: consumes: @@ -6265,7 +6240,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all results tags: - - EnetPulse - Results + - EnetPulse /api/v1/enetpulse/sports: get: consumes: @@ -6291,7 +6266,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all sports tags: - - EnetPulse - Sports + - EnetPulse /api/v1/enetpulse/tournament-stages: get: consumes: @@ -6317,7 +6292,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all tournament stages tags: - - EnetPulse - Tournament Stages + - EnetPulse /api/v1/enetpulse/tournament-templates: get: consumes: @@ -6343,7 +6318,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all tournament templates tags: - - EnetPulse - Tournament Templates + - EnetPulse /api/v1/enetpulse/tournaments: get: consumes: @@ -6369,7 +6344,7 @@ paths: $ref: '#/definitions/domain.ErrorResponse' summary: Get all tournaments tags: - - EnetPulse - Tournaments + - EnetPulse /api/v1/events: get: consumes: @@ -6966,71 +6941,6 @@ paths: summary: Retrieve all odds tags: - prematch - /api/v1/odds/pre-match: - get: - consumes: - - application/json - description: Fetches pre-match odds from EnetPulse for a given event - parameters: - - description: Event ID - in: query - name: objectFK - required: true - type: integer - - collectionFormat: csv - description: Odds provider IDs (comma separated) - in: query - items: - type: integer - name: oddsProviderFK - type: array - - description: Outcome type ID - in: query - name: outcomeTypeFK - type: integer - - description: Outcome scope ID - in: query - name: outcomeScopeFK - type: integer - - description: Outcome subtype ID - in: query - name: outcomeSubtypeFK - type: integer - - description: Limit results - in: query - name: limit - type: integer - - description: Offset results - in: query - name: offset - type: integer - - description: Language type ID - in: query - name: languageTypeFK - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.Response' - - properties: - data: - $ref: '#/definitions/domain.PreMatchOddsResponse' - type: object - "400": - description: Bad Request - schema: - $ref: '#/definitions/domain.ErrorResponse' - "502": - description: Bad Gateway - schema: - $ref: '#/definitions/domain.ErrorResponse' - summary: Get pre-match odds for an event - tags: - - EnetPulse - PreMatch /api/v1/odds/upcoming/{upcoming_id}: get: consumes: diff --git a/internal/web_server/handlers/enet_pulse.go b/internal/web_server/handlers/enet_pulse.go index 443a677..d3d812c 100644 --- a/internal/web_server/handlers/enet_pulse.go +++ b/internal/web_server/handlers/enet_pulse.go @@ -9,67 +9,10 @@ import ( "github.com/gofiber/fiber/v2" ) -// GetPreMatchOdds godoc -// @Summary Get pre-match odds for an event -// @Description Fetches pre-match odds from EnetPulse for a given event -// @Tags EnetPulse - PreMatch -// @Accept json -// @Produce json -// @Param objectFK query int true "Event ID" -// @Param oddsProviderFK query []int false "Odds provider IDs (comma separated)" -// @Param outcomeTypeFK query int false "Outcome type ID" -// @Param outcomeScopeFK query int false "Outcome scope ID" -// @Param outcomeSubtypeFK query int false "Outcome subtype ID" -// @Param limit query int false "Limit results" -// @Param offset query int false "Offset results" -// @Param languageTypeFK query int false "Language type ID" -// @Success 200 {object} domain.Response{data=domain.PreMatchOddsResponse} -// @Failure 400 {object} domain.ErrorResponse -// @Failure 502 {object} domain.ErrorResponse -// @Router /api/v1/odds/pre-match [get] -func (h *Handler) GetPreMatchOdds(c *fiber.Ctx) error { - // Parse query parameters - objectFK := c.QueryInt("objectFK") - if objectFK == 0 { - return c.Status(fiber.StatusBadRequest).JSON(domain.ErrorResponse{ - Message: "Event ID (objectFK) is required", - Error: "missing or invalid objectFK", - }) - } - - params := domain.PreMatchOddsRequest{ - ObjectFK: int64(objectFK), - OddsProviderFK: intSliceToInt64Slice(parseIntSlice(c.Query("oddsProviderFK"))), // convert []int to []int64 - OutcomeTypeFK: int64(c.QueryInt("outcomeTypeFK")), - OutcomeScopeFK: int64(c.QueryInt("outcomeScopeFK")), - OutcomeSubtypeFK: int64(c.QueryInt("outcomeSubtypeFK")), - Limit: c.QueryInt("limit"), - Offset: c.QueryInt("offset"), - LanguageTypeFK: int64(c.QueryInt("languageTypeFK")), - } - - // Call service - res, err := h.enetPulseSvc.FetchPreMatchOdds(c.Context(), params) - if err != nil { - log.Println("FetchPreMatchOdds error:", err) - return c.Status(fiber.StatusBadGateway).JSON(domain.ErrorResponse{ - Message: "Failed to fetch pre-match odds", - Error: err.Error(), - }) - } - - return c.Status(fiber.StatusOK).JSON(domain.Response{ - Message: "Pre-match odds fetched successfully", - Data: res, - StatusCode: fiber.StatusOK, - Success: true, - }) -} - // GetAllSports godoc // @Summary Get all sports // @Description Fetches all sports stored in the database -// @Tags EnetPulse - Sports +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseSport} @@ -97,7 +40,7 @@ func (h *Handler) GetAllSports(c *fiber.Ctx) error { // GetAllTournamentTemplates godoc // @Summary Get all tournament templates // @Description Fetches all tournament templates stored in the database -// @Tags EnetPulse - Tournament Templates +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseTournamentTemplate} @@ -125,7 +68,7 @@ func (h *Handler) GetAllTournamentTemplates(c *fiber.Ctx) error { // GetAllTournaments godoc // @Summary Get all tournaments // @Description Fetches all tournaments stored in the database -// @Tags EnetPulse - Tournaments +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseTournament} @@ -153,7 +96,7 @@ func (h *Handler) GetAllTournaments(c *fiber.Ctx) error { // GetAllTournamentStages godoc // @Summary Get all tournament stages // @Description Fetches all tournament stages stored in the database -// @Tags EnetPulse - Tournament Stages +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseTournamentStage} @@ -181,7 +124,7 @@ func (h *Handler) GetAllTournamentStages(c *fiber.Ctx) error { // GetFixturesByDate godoc // @Summary Get all stored fixtures // @Description Fetches all fixtures stored in the database -// @Tags EnetPulse - Fixtures +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseFixture} @@ -209,7 +152,7 @@ func (h *Handler) GetFixturesByDate(c *fiber.Ctx) error { // GetAllResults godoc // @Summary Get all results // @Description Fetches all EnetPulse match results stored in the database -// @Tags EnetPulse - Results +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseResult} @@ -237,7 +180,7 @@ func (h *Handler) GetAllResults(c *fiber.Ctx) error { // GetAllPreodds godoc // @Summary Get all preodds // @Description Fetches all EnetPulse pre-match odds stored in the database -// @Tags EnetPulse - Preodds +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulsePreodds} @@ -265,7 +208,7 @@ func (h *Handler) GetAllPreodds(c *fiber.Ctx) error { // GetFixturesWithPreodds godoc // @Summary Get fixtures with preodds // @Description Fetches all EnetPulse fixtures along with their associated pre-match odds -// @Tags EnetPulse - Fixtures +// @Tags EnetPulse // @Accept json // @Produce json // @Success 200 {object} domain.Response{data=[]domain.EnetpulseFixtureWithPreodds}