42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CreateCustomerPointsRequest struct {
|
|
CustomerID uuid.UUID `json:"customer_id" validate:"required"`
|
|
Balance int64 `json:"balance" validate:"min=0"`
|
|
}
|
|
|
|
type UpdateCustomerPointsRequest struct {
|
|
Balance int64 `json:"balance" validate:"min=0"`
|
|
}
|
|
|
|
type AddCustomerPointsRequest struct {
|
|
Points int64 `json:"points" validate:"required,min=1"`
|
|
}
|
|
|
|
type DeductCustomerPointsRequest struct {
|
|
Points int64 `json:"points" validate:"required,min=1"`
|
|
}
|
|
|
|
type CustomerPointsResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
CustomerID uuid.UUID `json:"customer_id"`
|
|
Balance int64 `json:"balance"`
|
|
Customer *CustomerResponse `json:"customer,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ListCustomerPointsQuery struct {
|
|
Page int `query:"page" validate:"min=1"`
|
|
Limit int `query:"limit" validate:"min=1,max=100"`
|
|
Search string `query:"search"`
|
|
SortBy string `query:"sort_by" validate:"omitempty,oneof=balance created_at updated_at"`
|
|
SortOrder string `query:"sort_order" validate:"omitempty,oneof=asc desc"`
|
|
}
|