45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
package contract
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CreateTierRequest struct {
|
|
Name string `json:"name" validate:"required"`
|
|
MinPoints int64 `json:"min_points" validate:"min=0"`
|
|
Benefits map[string]interface{} `json:"benefits"`
|
|
}
|
|
|
|
type UpdateTierRequest struct {
|
|
Name *string `json:"name,omitempty" validate:"omitempty,required"`
|
|
MinPoints *int64 `json:"min_points,omitempty" validate:"omitempty,min=0"`
|
|
Benefits map[string]interface{} `json:"benefits,omitempty"`
|
|
}
|
|
|
|
type TierResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
MinPoints int64 `json:"min_points"`
|
|
Benefits map[string]interface{} `json:"benefits"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ListTiersRequest struct {
|
|
Page int `form:"page" validate:"min=1"`
|
|
Limit int `form:"limit" validate:"min=1,max=100"`
|
|
Search string `form:"search"`
|
|
SortBy string `form:"sort_by" validate:"omitempty,oneof=name min_points created_at updated_at"`
|
|
SortOrder string `form:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
}
|
|
|
|
type PaginatedTiersResponse struct {
|
|
Data []TierResponse `json:"data"`
|
|
TotalCount int `json:"total_count"`
|
|
Page int `json:"page"`
|
|
Limit int `json:"limit"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|