84 lines
2.1 KiB
Go
84 lines
2.1 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type Raffle struct {
|
|
ID int32
|
|
CompanyID int32
|
|
Name string
|
|
CreatedAt time.Time
|
|
ExpiresAt time.Time
|
|
Type string
|
|
Status string
|
|
}
|
|
|
|
type RaffleFilter struct {
|
|
// requireds will depend on type of raffle (sport or game)
|
|
Type string `json:"type" validate:"required,oneof=sport game"`
|
|
RaffleID int32 `json:"raffle_id" validate:"required"`
|
|
SportID int32 `json:"sport_id" validate:"required_if=Type sport"`
|
|
LeagueID int32 `json:"league_id" validate:"required_if=Type sport"`
|
|
GameID string `json:"game_id" validate:"required_if=Type game"`
|
|
}
|
|
|
|
type RaffleStanding struct {
|
|
UserID int64
|
|
RaffleID int32
|
|
FirstName string
|
|
LastName string
|
|
PhoneNumber string
|
|
Email string
|
|
TicketCount int64
|
|
}
|
|
|
|
type RaffleStandingRes struct {
|
|
UserID int64 `json:"user_id"`
|
|
RaffleID int32 `json:"raffle_id"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
PhoneNumber string `json:"phone_number"`
|
|
Email string `json:"email"`
|
|
TicketCount int64 `json:"ticket_count"`
|
|
}
|
|
|
|
type RaffleWinnerParams struct {
|
|
RaffleID int32
|
|
UserID int32
|
|
Rank int32
|
|
}
|
|
|
|
type RaffleTicket struct {
|
|
ID int32
|
|
RaffleID int32
|
|
UserID int32
|
|
IsActive bool
|
|
}
|
|
|
|
type RaffleTicketRes struct {
|
|
TicketID int32
|
|
UserID int32
|
|
Name string
|
|
Type string
|
|
ExpiresAt time.Time
|
|
Status string
|
|
}
|
|
|
|
type CreateRaffle struct {
|
|
CompanyID int32 `json:"company_id" validate:"required"`
|
|
Name string `json:"name" validate:"required"`
|
|
ExpiresAt *time.Time `json:"expires_at" validate:"required"`
|
|
Type string `json:"type" validate:"required"`
|
|
}
|
|
|
|
type CreateRaffleTicket struct {
|
|
RaffleID int32 `json:"raffle_id" validate:"required"`
|
|
UserID int32 `json:"user_id" validate:"required"`
|
|
}
|
|
|
|
// aside from ID, atleast one of the fields should be required
|
|
type UpdateRaffleParams struct {
|
|
ID int32 `json:"id" validate:"required"`
|
|
Name string `json:"name" validate:"required_without_all=ExpiresAt"`
|
|
ExpiresAt *time.Time `json:"expires_at" validate:"required_without_all=Name"`
|
|
}
|