model

package
v0.0.0-...-32a9906 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Booking

type Booking struct {
	ID        uuid.UUID `json:"id" validate:"required"`
	EventID   uuid.UUID `json:"event_id" validate:"required"`
	UserID    uuid.UUID `json:"user_id" validate:"required"`
	Status    string    `json:"status" validate:"required"`
	Quantity  int       `json:"quantity" validate:"required"`
	CreatedAt time.Time `json:"created_at" validate:"required"`
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

type Event

type Event struct {
	ID               uuid.UUID `json:"id" db:"id"`
	Title            string    `json:"title" db:"title"`
	Description      string    `json:"description" db:"description"`
	StartTime        time.Time `json:"start_time" db:"start_time"`
	EndTime          time.Time `json:"end_time" db:"end_time"`
	Location         string    `json:"location" db:"location"`
	Capacity         int       `json:"capacity" db:"capacity"`
	AvailableTickets int       `json:"available_tickets" db:"available_tickets"`
	Price            float64   `json:"price" db:"price"`
	OrganizerId      uuid.UUID `json:"organizer_id" db:"organizer_id"`
	CategoryId       uuid.UUID `json:"category_id" db:"category_id"`
	Status           string    `json:"status" db:"status"`
	CreatedAt        time.Time `json:"created_at" db:"created_at"`
	UpdatedAt        time.Time `json:"updated_at" db:"updated_at"`
}

func (*Event) CheckTicketAvailability

func (e *Event) CheckTicketAvailability(requestedTickets int) error

CheckTicketAvailability verifies if the requested number of tickets is available

func (*Event) ReleaseTickets

func (e *Event) ReleaseTickets(tickets int) error

ReleaseTickets releases the specified number of tickets back to the available pool

func (*Event) ReserveTickets

func (e *Event) ReserveTickets(tickets int) error

ReserveTickets attempts to reserve the specified number of tickets

type EventStatus

type EventStatus string
const (
	EventStatusDraft     EventStatus = "draft"
	EventStatusPublished EventStatus = "published"
	EventStatusCancelled EventStatus = "cancelled"
	EventStatusCompleted EventStatus = "completed"
)

func (EventStatus) Validate

func (s EventStatus) Validate() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL