Documentation ¶
Index ¶
Constants ¶
View Source
const LimitIncoming = 5
Variables ¶
View Source
var ( ErrInvalidReservation = errors.New("invalid reservation") ErrUserNotConfirmed = errors.New("you must confirm your email to create a reservation") ErrLimitReservations = fmt.Errorf("you can't create more than %d incoming reservations", LimitIncoming) ErrInvalidFeatureDate = errors.New("invalid feature date") )
View Source
var Table = "reservations"
Functions ¶
Types ¶
type BookedReservation ¶
type BookedReservation struct { ID int `json:"id"` SlotID int `json:"slot_id"` CourtID int `json:"court_id"` Date time.Time `json:"date"` }
BookedReservation contains the schema for booked reservations
func ReadBooked ¶
ReadBooked operates as controller to find all booked slots for the next 30 days
type NewReservation ¶
type NewReservation struct { UserID int `json:"-"` SlotID int `json:"slot_id"` CourtID int `json:"court_id"` Date time.Time `json:"date"` CreatedAt time.Time `json:"-"` }
NewReservation contains the schema to create new identity
type Reservation ¶
type Reservation struct { ID int `json:"id" gorm:"primary_key;unique;not null"` UserID int `json:"user_id" gorm:"not null"` SlotID int `json:"slot_id" gorm:"not null"` CourtID int `json:"court_id" gorm:"not null"` Date time.Time `json:"date" gorm:"not null"` CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;not null"` }
Reservation contains the schema for specific identity
func ReadCourtID ¶
ReadCourtID operates as controller to list reservations by court ID
func ReadUserID ¶
ReadUserID operates as controller to list reservations by user ID
type Statistics ¶
type Statistics struct { Total int `json:"total"` LastWeek int `json:"last_week"` LastMonth int `json:"last_month"` Incoming int `json:"incoming"` PerCourt map[string]int `json:"per_court"` PerSlot map[string]int `json:"per_slot"` PerWeekday map[string]int `json:"per_weekday"` }
Metrics contains the schema for reservations metrics
func ReadStatistics ¶
ReadStatistics operates as controller to calculate statistics for reservations
Click to show internal directories.
Click to hide internal directories.