recommendation service

This commit is contained in:
Yared Yemane 2025-05-28 13:46:28 +03:00
parent c9dcb3949d
commit c637ddb321
6 changed files with 292 additions and 7 deletions

View File

@ -519,8 +519,7 @@ const docTemplate = `{
"200": { "200": {
"description": "Recommended games fetched successfully", "description": "Recommended games fetched successfully",
"schema": { "schema": {
"type": "object", "$ref": "#/definitions/domain.RecommendationSuccessfulResponse"
"additionalProperties": true
} }
}, },
"500": { "500": {
@ -3389,6 +3388,44 @@ const docTemplate = `{
} }
} }
}, },
"/user/bets": {
"get": {
"description": "Gets user bets",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Gets user bets",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.BetRes"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/user/checkPhoneEmailExist": { "/user/checkPhoneEmailExist": {
"post": { "post": {
"description": "Check if phone number or email exist", "description": "Check if phone number or email exist",
@ -4332,6 +4369,10 @@ const docTemplate = `{
"type": "boolean", "type": "boolean",
"example": false "example": false
}, },
"created_at": {
"type": "string",
"example": "2025-04-08T12:00:00Z"
},
"full_name": { "full_name": {
"type": "string", "type": "string",
"example": "John" "example": "John"
@ -4725,6 +4766,20 @@ const docTemplate = `{
} }
} }
}, },
"domain.RecommendationSuccessfulResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"recommended_games": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.VirtualGame"
}
}
}
},
"domain.ReferralSettings": { "domain.ReferralSettings": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -5069,6 +5124,50 @@ const docTemplate = `{
} }
} }
}, },
"domain.VirtualGame": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_featured": {
"type": "boolean"
},
"max_bet": {
"type": "number"
},
"min_bet": {
"type": "number"
},
"name": {
"type": "string"
},
"popularity_score": {
"type": "integer"
},
"provider": {
"type": "string"
},
"rtp": {
"type": "number"
},
"thumbnail_url": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"volatility": {
"type": "string"
}
}
},
"handlers.AdminRes": { "handlers.AdminRes": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -511,8 +511,7 @@
"200": { "200": {
"description": "Recommended games fetched successfully", "description": "Recommended games fetched successfully",
"schema": { "schema": {
"type": "object", "$ref": "#/definitions/domain.RecommendationSuccessfulResponse"
"additionalProperties": true
} }
}, },
"500": { "500": {
@ -3381,6 +3380,44 @@
} }
} }
}, },
"/user/bets": {
"get": {
"description": "Gets user bets",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Gets user bets",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.BetRes"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/user/checkPhoneEmailExist": { "/user/checkPhoneEmailExist": {
"post": { "post": {
"description": "Check if phone number or email exist", "description": "Check if phone number or email exist",
@ -4324,6 +4361,10 @@
"type": "boolean", "type": "boolean",
"example": false "example": false
}, },
"created_at": {
"type": "string",
"example": "2025-04-08T12:00:00Z"
},
"full_name": { "full_name": {
"type": "string", "type": "string",
"example": "John" "example": "John"
@ -4717,6 +4758,20 @@
} }
} }
}, },
"domain.RecommendationSuccessfulResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"recommended_games": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.VirtualGame"
}
}
}
},
"domain.ReferralSettings": { "domain.ReferralSettings": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -5061,6 +5116,50 @@
} }
} }
}, },
"domain.VirtualGame": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_featured": {
"type": "boolean"
},
"max_bet": {
"type": "number"
},
"min_bet": {
"type": "number"
},
"name": {
"type": "string"
},
"popularity_score": {
"type": "integer"
},
"provider": {
"type": "string"
},
"rtp": {
"type": "number"
},
"thumbnail_url": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"volatility": {
"type": "string"
}
}
},
"handlers.AdminRes": { "handlers.AdminRes": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -94,6 +94,9 @@ definitions:
cashed_out: cashed_out:
example: false example: false
type: boolean type: boolean
created_at:
example: "2025-04-08T12:00:00Z"
type: string
full_name: full_name:
example: John example: John
type: string type: string
@ -362,6 +365,15 @@ definitions:
message: message:
type: string type: string
type: object type: object
domain.RecommendationSuccessfulResponse:
properties:
message:
type: string
recommended_games:
items:
$ref: '#/definitions/domain.VirtualGame'
type: array
type: object
domain.ReferralSettings: domain.ReferralSettings:
properties: properties:
betReferralBonusPercentage: betReferralBonusPercentage:
@ -601,6 +613,35 @@ definitions:
status: status:
type: string type: string
type: object type: object
domain.VirtualGame:
properties:
category:
type: string
created_at:
type: string
id:
type: integer
is_featured:
type: boolean
max_bet:
type: number
min_bet:
type: number
name:
type: string
popularity_score:
type: integer
provider:
type: string
rtp:
type: number
thumbnail_url:
type: string
updated_at:
type: string
volatility:
type: string
type: object
handlers.AdminRes: handlers.AdminRes:
properties: properties:
created_at: created_at:
@ -1783,8 +1824,7 @@ paths:
"200": "200":
description: Recommended games fetched successfully description: Recommended games fetched successfully
schema: schema:
additionalProperties: true $ref: '#/definitions/domain.RecommendationSuccessfulResponse'
type: object
"500": "500":
description: Failed to fetch recommendations description: Failed to fetch recommendations
schema: schema:
@ -3670,6 +3710,31 @@ paths:
summary: Get transfer by wallet summary: Get transfer by wallet
tags: tags:
- transfer - transfer
/user/bets:
get:
consumes:
- application/json
description: Gets user bets
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/domain.BetRes'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
summary: Gets user bets
tags:
- user
/user/checkPhoneEmailExist: /user/checkPhoneEmailExist:
post: post:
consumes: consumes:

View File

@ -1,5 +1,11 @@
package domain package domain
type RecommendationSuccessfulResponse struct {
Message string `json:"message"`
RecommendedGames []VirtualGame `json:"recommended_games"`
}
type RecommendationErrorResponse struct { type RecommendationErrorResponse struct {
Message string `json:"message"` Message string `json:"message"`
} }

View File

@ -4,6 +4,22 @@ import (
"time" "time"
) )
type VirtualGame struct {
ID int64 `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"`
Category string `json:"category"`
MinBet float64 `json:"min_bet"`
MaxBet float64 `json:"max_bet"`
Volatility string `json:"volatility"`
RTP float64 `json:"rtp"`
IsFeatured bool `json:"is_featured"`
PopularityScore int `json:"popularity_score"`
ThumbnailURL string `json:"thumbnail_url"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type VirtualGameSession struct { type VirtualGameSession struct {
ID int64 `json:"id"` ID int64 `json:"id"`
UserID int64 `json:"user_id"` UserID int64 `json:"user_id"`

View File

@ -10,7 +10,7 @@ import (
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Param userID path string true "User ID" // @Param userID path string true "User ID"
// @Success 200 {object} map[string]interface{} "Recommended games fetched successfully" // @Success 200 {object} domain.RecommendationSuccessfulResponse "Recommended games fetched successfully"
// @Failure 500 {object} domain.RecommendationErrorResponse "Failed to fetch recommendations" // @Failure 500 {object} domain.RecommendationErrorResponse "Failed to fetch recommendations"
// @Router /api/v1/virtual-games/recommendations/{userID} [get] // @Router /api/v1/virtual-games/recommendations/{userID} [get]
func (h *Handler) GetRecommendations(c *fiber.Ctx) error { func (h *Handler) GetRecommendations(c *fiber.Ctx) error {