53 lines
1.7 KiB
Go
53 lines
1.7 KiB
Go
package contract
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CreateCustomerTokensRequest struct {
|
|
CustomerID uuid.UUID `json:"customer_id" validate:"required"`
|
|
TokenType string `json:"token_type" validate:"required,oneof=SPIN RAFFLE MINIGAME"`
|
|
Balance int64 `json:"balance" validate:"min=0"`
|
|
}
|
|
|
|
type UpdateCustomerTokensRequest struct {
|
|
Balance int64 `json:"balance" validate:"min=0"`
|
|
}
|
|
|
|
type AddCustomerTokensRequest struct {
|
|
Tokens int64 `json:"tokens" validate:"required,min=1"`
|
|
}
|
|
|
|
type DeductCustomerTokensRequest struct {
|
|
Tokens int64 `json:"tokens" validate:"required,min=1"`
|
|
}
|
|
|
|
type CustomerTokensResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
CustomerID uuid.UUID `json:"customer_id"`
|
|
TokenType string `json:"token_type"`
|
|
Balance int64 `json:"balance"`
|
|
Customer *CustomerResponse `json:"customer,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ListCustomerTokensRequest struct {
|
|
Page int `json:"page" validate:"min=1"`
|
|
Limit int `json:"limit" validate:"min=1,max=100"`
|
|
Search string `json:"search"`
|
|
TokenType string `json:"token_type" validate:"omitempty,oneof=SPIN RAFFLE MINIGAME"`
|
|
SortBy string `json:"sort_by" validate:"omitempty,oneof=balance token_type created_at updated_at"`
|
|
SortOrder string `json:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
}
|
|
|
|
type PaginatedCustomerTokensResponse struct {
|
|
Data []CustomerTokensResponse `json:"data"`
|
|
TotalCount int `json:"total_count"`
|
|
Page int `json:"page"`
|
|
Limit int `json:"limit"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|