{ "swagger": "2.0", "info": { "description": "This is server for FortuneBet.", "title": "FortuneBet API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "paths": { "/auth/login": { "post": { "description": "Login customer", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Login customer", "parameters": [ { "description": "Login customer", "name": "login", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.loginCustomerReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.loginCustomerRes" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/auth/logout": { "post": { "description": "Logout customer", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Logout customer", "parameters": [ { "description": "Logout customer", "name": "logout", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.logoutReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/auth/refresh": { "post": { "description": "Refresh token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Refresh token", "parameters": [ { "description": "tokens", "name": "refresh", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.refreshToken" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.loginCustomerRes" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/events": { "get": { "description": "Retrieve all upcoming events from the database", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve all upcoming events", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.UpcomingEvent" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/events/{id}": { "get": { "description": "Retrieve an upcoming event by ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve an upcoming by ID", "parameters": [ { "type": "string", "description": "ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.UpcomingEvent" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/odds": { "get": { "description": "Retrieve all prematch odds from the database", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve all prematch odds", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Odd" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/odds/raw/{raw_odds_id}": { "get": { "description": "Retrieve raw odds by raw odds ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve raw odds by ID", "parameters": [ { "type": "string", "description": "Raw Odds ID", "name": "raw_odds_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.RawOddsByID" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/odds/upcoming/{upcoming_id}": { "get": { "description": "Retrieve prematch odds by upcoming event ID (FI from Bet365) with optional pagination", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve prematch odds by upcoming ID (FI)", "parameters": [ { "type": "string", "description": "Upcoming Event ID (FI)", "name": "upcoming_id", "in": "path", "required": true }, { "type": "integer", "description": "Number of results to return (default: 10)", "name": "limit", "in": "query" }, { "type": "integer", "description": "Number of results to skip (default: 0)", "name": "offset", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Odd" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/prematch/odds/{event_id}": { "get": { "description": "Retrieve prematch odds for a specific event by event ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "prematch" ], "summary": "Retrieve prematch odds for an event", "parameters": [ { "type": "string", "description": "Event ID", "name": "event_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Odd" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/checkPhoneEmailExist": { "post": { "description": "Check if phone number or email exist", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Check if phone number or email exist", "parameters": [ { "description": "Check phone number or email exist", "name": "checkPhoneEmailExist", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.CheckPhoneEmailExistReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.CheckPhoneEmailExistRes" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/profile": { "get": { "security": [ { "Bearer": [] } ], "description": "Get user profile", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Get user profile", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.UserProfileRes" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/register": { "post": { "description": "Register user", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Register user", "parameters": [ { "description": "Register user", "name": "registerUser", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.RegisterUserReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/resetPassword": { "post": { "description": "Reset password", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Reset password", "parameters": [ { "description": "Reset password", "name": "resetPassword", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.ResetPasswordReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/sendRegisterCode": { "post": { "description": "Send register code", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Send register code", "parameters": [ { "description": "Send register code", "name": "registerCode", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.RegisterCodeReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } }, "/user/sendResetCode": { "post": { "description": "Send reset code", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Send reset code", "parameters": [ { "description": "Send reset code", "name": "resetCode", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.ResetCodeReq" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/response.APIResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/response.APIResponse" } } } } } }, "definitions": { "domain.Odd": { "type": "object", "properties": { "category": { "type": "string" }, "event_id": { "type": "string" }, "fetched_at": { "type": "string" }, "fi": { "type": "string" }, "handicap": { "type": "string" }, "is_active": { "type": "boolean" }, "market_category": { "type": "string" }, "market_id": { "type": "string" }, "market_name": { "type": "string" }, "market_type": { "type": "string" }, "name": { "type": "string" }, "odds_value": { "type": "number" }, "raw_odds": { "type": "array", "items": {} }, "section": { "type": "string" }, "source": { "type": "string" } } }, "domain.RawOddsByID": { "type": "object", "properties": { "event_id": { "type": "string" }, "fetched_at": { "type": "string" }, "id": { "type": "integer" }, "raw_odds": { "type": "array", "items": {} } } }, "domain.Role": { "type": "string", "enum": [ "super_admin", "admin", "branch_manager", "customer", "cashier" ], "x-enum-varnames": [ "RoleSuperAdmin", "RoleAdmin", "RoleBranchManager", "RoleCustomer", "RoleCashier" ] }, "domain.UpcomingEvent": { "type": "object", "properties": { "awayKitImage": { "description": "Kit or image for away team (optional)", "type": "string" }, "awayTeam": { "description": "Away team name (can be empty/null)", "type": "string" }, "awayTeamID": { "description": "Away team ID (can be empty/null)", "type": "string" }, "homeKitImage": { "description": "Kit or image for home team (optional)", "type": "string" }, "homeTeam": { "description": "Home team name (if available)", "type": "string" }, "homeTeamID": { "description": "Home team ID", "type": "string" }, "id": { "description": "Event ID", "type": "string" }, "leagueCC": { "description": "League country code", "type": "string" }, "leagueID": { "description": "League ID", "type": "string" }, "leagueName": { "description": "League name", "type": "string" }, "matchName": { "description": "Match or event name", "type": "string" }, "sportID": { "description": "Sport ID", "type": "string" }, "startTime": { "description": "Converted from \"time\" field in UNIX format", "type": "string" } } }, "handlers.CheckPhoneEmailExistReq": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "phone_number": { "type": "string", "example": "1234567890" } } }, "handlers.CheckPhoneEmailExistRes": { "type": "object", "properties": { "email_exist": { "type": "boolean" }, "phone_number_exist": { "type": "boolean" } } }, "handlers.RegisterCodeReq": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "phone_number": { "type": "string", "example": "1234567890" } } }, "handlers.RegisterUserReq": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "first_name": { "type": "string", "example": "John" }, "last_name": { "type": "string", "example": "Doe" }, "otp": { "description": "Role string", "type": "string", "example": "123456" }, "password": { "type": "string", "example": "password123" }, "phone_number": { "type": "string", "example": "1234567890" }, "referal_code": { "type": "string", "example": "ABC123" } } }, "handlers.ResetCodeReq": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "phone_number": { "type": "string", "example": "1234567890" } } }, "handlers.ResetPasswordReq": { "type": "object", "properties": { "email": { "type": "string" }, "otp": { "type": "string" }, "password": { "type": "string" }, "phoneNumber": { "type": "string" } } }, "handlers.UserProfileRes": { "type": "object", "properties": { "created_at": { "type": "string" }, "email": { "type": "string" }, "email_verified": { "type": "boolean" }, "first_name": { "type": "string" }, "id": { "type": "integer" }, "last_name": { "type": "string" }, "phone_number": { "type": "string" }, "phone_verified": { "type": "boolean" }, "role": { "$ref": "#/definitions/domain.Role" }, "suspended": { "type": "boolean" }, "suspended_at": { "type": "string" }, "updated_at": { "type": "string" } } }, "handlers.loginCustomerReq": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "password": { "type": "string", "example": "password123" }, "phone_number": { "type": "string", "example": "1234567890" } } }, "handlers.loginCustomerRes": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" } } }, "handlers.logoutReq": { "type": "object", "properties": { "refresh_token": { "type": "string" } } }, "handlers.refreshToken": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" } } }, "response.APIResponse": { "type": "object", "properties": { "data": {}, "message": { "type": "string" }, "metadata": {}, "status": { "$ref": "#/definitions/response.Status" }, "timestamp": { "type": "string" } } }, "response.Status": { "type": "string", "enum": [ "error", "success" ], "x-enum-varnames": [ "Error", "Success" ] } }, "securityDefinitions": { "Bearer": { "type": "apiKey", "name": "Authorization", "in": "header" } } }