72 lines
2.9 KiB
Go
72 lines
2.9 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CreateRewardRequest struct {
|
|
Name string `json:"name" binding:"required,min=1,max=150"`
|
|
RewardType string `json:"reward_type" binding:"required,oneof=VOUCHER PHYSICAL DIGITAL BALANCE"`
|
|
CostPoints int64 `json:"cost_points" binding:"required,min=1"`
|
|
Stock *int `json:"stock,omitempty"`
|
|
MaxPerCustomer int `json:"max_per_customer" binding:"min=1"`
|
|
Tnc *TermsAndConditionsStruct `json:"tnc,omitempty"`
|
|
Metadata *map[string]interface{} `json:"metadata,omitempty"`
|
|
Images *[]string `json:"images,omitempty"`
|
|
}
|
|
|
|
type UpdateRewardRequest struct {
|
|
ID uuid.UUID `json:"id" binding:"required"`
|
|
Name string `json:"name" binding:"required,min=1,max=150"`
|
|
RewardType string `json:"reward_type" binding:"required,oneof=VOUCHER PHYSICAL DIGITAL BALANCE"`
|
|
CostPoints int64 `json:"cost_points" binding:"required,min=1"`
|
|
Stock *int `json:"stock,omitempty"`
|
|
MaxPerCustomer int `json:"max_per_customer" binding:"min=1"`
|
|
Tnc *TermsAndConditionsStruct `json:"tnc,omitempty"`
|
|
Metadata *map[string]interface{} `json:"metadata,omitempty"`
|
|
Images *[]string `json:"images,omitempty"`
|
|
}
|
|
|
|
type ListRewardsRequest struct {
|
|
Page int `form:"page" binding:"min=1"`
|
|
Limit int `form:"limit" binding:"min=1,max=100"`
|
|
Search string `form:"search"`
|
|
RewardType string `form:"reward_type"`
|
|
MinPoints *int64 `form:"min_points"`
|
|
MaxPoints *int64 `form:"max_points"`
|
|
HasStock *bool `form:"has_stock"`
|
|
}
|
|
|
|
type RewardResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
RewardType string `json:"reward_type"`
|
|
CostPoints int64 `json:"cost_points"`
|
|
Stock *int `json:"stock,omitempty"`
|
|
MaxPerCustomer int `json:"max_per_customer"`
|
|
Tnc *TermsAndConditionsStruct `json:"tnc,omitempty"`
|
|
Metadata *map[string]interface{} `json:"metadata,omitempty"`
|
|
Images *[]string `json:"images,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ListRewardsResponse struct {
|
|
Rewards []RewardResponse `json:"rewards"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
Limit int `json:"limit"`
|
|
}
|
|
|
|
type TermsAndConditionsStruct struct {
|
|
Sections []TncSectionStruct `json:"sections"`
|
|
ExpiryDays int `json:"expiry_days"`
|
|
}
|
|
|
|
type TncSectionStruct struct {
|
|
Title string `json:"title"`
|
|
Rules []string `json:"rules"`
|
|
}
|