2025-09-17 19:30:17 +07:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type CreateGamePrizeRequest struct {
|
|
|
|
|
GameID uuid.UUID `json:"game_id" validate:"required"`
|
|
|
|
|
Name string `json:"name" validate:"required"`
|
|
|
|
|
Weight int `json:"weight" validate:"min=1"`
|
|
|
|
|
Stock int `json:"stock" validate:"min=0"`
|
|
|
|
|
MaxStock *int `json:"max_stock,omitempty"`
|
|
|
|
|
Threshold *int64 `json:"threshold,omitempty"`
|
|
|
|
|
FallbackPrizeID *uuid.UUID `json:"fallback_prize_id,omitempty"`
|
2025-09-18 12:01:20 +07:00
|
|
|
Image *string `json:"image,omitempty" validate:"omitempty,max=500"`
|
2025-09-17 19:30:17 +07:00
|
|
|
Metadata map[string]interface{} `json:"metadata"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateGamePrizeRequest struct {
|
|
|
|
|
Name *string `json:"name,omitempty" validate:"omitempty,required"`
|
|
|
|
|
Weight *int `json:"weight,omitempty" validate:"omitempty,min=1"`
|
|
|
|
|
Stock *int `json:"stock,omitempty" validate:"omitempty,min=0"`
|
|
|
|
|
MaxStock *int `json:"max_stock,omitempty"`
|
|
|
|
|
Threshold *int64 `json:"threshold,omitempty"`
|
|
|
|
|
FallbackPrizeID *uuid.UUID `json:"fallback_prize_id,omitempty"`
|
2025-09-18 12:01:20 +07:00
|
|
|
Image *string `json:"image,omitempty" validate:"omitempty,max=500"`
|
2025-09-17 19:30:17 +07:00
|
|
|
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GamePrizeResponse struct {
|
|
|
|
|
ID uuid.UUID `json:"id"`
|
|
|
|
|
GameID uuid.UUID `json:"game_id"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Weight int `json:"weight"`
|
|
|
|
|
Stock int `json:"stock"`
|
|
|
|
|
MaxStock *int `json:"max_stock,omitempty"`
|
|
|
|
|
Threshold *int64 `json:"threshold,omitempty"`
|
|
|
|
|
FallbackPrizeID *uuid.UUID `json:"fallback_prize_id,omitempty"`
|
2025-09-18 12:01:20 +07:00
|
|
|
Image *string `json:"image,omitempty"`
|
2025-09-17 19:30:17 +07:00
|
|
|
Metadata map[string]interface{} `json:"metadata"`
|
|
|
|
|
Game *GameResponse `json:"game,omitempty"`
|
|
|
|
|
FallbackPrize *GamePrizeResponse `json:"fallback_prize,omitempty"`
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ListGamePrizesQuery struct {
|
|
|
|
|
Page int `query:"page" validate:"min=1"`
|
|
|
|
|
Limit int `query:"limit" validate:"min=1,max=100"`
|
|
|
|
|
Search string `query:"search"`
|
|
|
|
|
GameID *uuid.UUID `query:"game_id"`
|
|
|
|
|
SortBy string `query:"sort_by" validate:"omitempty,oneof=name weight stock created_at updated_at"`
|
|
|
|
|
SortOrder string `query:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
|
|
|
}
|