Documentation
¶
Index ¶
- Constants
- func ValidPuljeValues() []string
- type AgeGroup
- type Billettholder
- type BillettholderEmail
- type BillettholderEmailKind
- type BillettholderUsers
- type DBDateTime
- func (dbDateTime DBDateTime) Format(layout string) string
- func (dbDateTime DBDateTime) IsZero() bool
- func (dbDateTime DBDateTime) MarshalJSON() ([]byte, error)
- func (dbDateTime *DBDateTime) Scan(value any) error
- func (dbDateTime DBDateTime) TimeOrZero() time.Time
- func (dbDateTime *DBDateTime) UnmarshalJSON(value []byte) error
- func (dbDateTime DBDateTime) Value() (driver.Value, error)
- type Event
- type EventCardModel
- type EventPlayer
- type EventPlayerRole
- type EventPulje
- type EventStatus
- type EventType
- type Interest
- type InterestLevel
- type Pulje
- type PuljeRow
- type PuljeStatus
- type Room
- type RoomByPulje
- type RoomEventPuljeSummary
- type RoomInput
- type RoomStatusByPulje
- type RoomStatusRow
- type Runtime
- type User
Constants ¶
const DBDateTimeNowSQL = "strftime('%Y-%m-%dT%H:%M:%fZ', 'now')"
Variables ¶
This section is empty.
Functions ¶
func ValidPuljeValues ¶
func ValidPuljeValues() []string
Types ¶
type Billettholder ¶
type Billettholder struct {
ID int `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Emails []BillettholderEmail `json:"emails,omitempty"`
TicketTypeId int `json:"ticket_type_id"`
TicketType string `json:"ticket_type"`
IsOver18 bool `json:"is_over_18"`
OrderID int `json:"order_id"`
TicketID int `json:"ticket_id"`
CreatedAt DBDateTime `json:"created_at"`
UpdatedAt DBDateTime `json:"updated_at"`
CreatedByID sql.NullInt64 `json:"created_by_id"`
UpdatedByID sql.NullInt64 `json:"updated_by_id"`
}
type BillettholderEmail ¶
type BillettholderEmail struct {
ID int `json:"id"`
BillettholderID int `json:"billettholder_id"`
Email string `json:"email"`
Kind BillettholderEmailKind `json:"kind"` // See BillettholderEmailKind constants.
CreatedAt DBDateTime `json:"created_at"`
UpdatedAt DBDateTime `json:"updated_at"`
CreatedByID sql.NullInt64 `json:"created_by_id"`
UpdatedByID sql.NullInt64 `json:"updated_by_id"`
}
type BillettholderEmailKind ¶
type BillettholderEmailKind string
const ( BillettholderEmailKindTicket BillettholderEmailKind = "Ticket" BillettholderEmailKindAssociated BillettholderEmailKind = "Associated" BillettholderEmailKindManual BillettholderEmailKind = "Manual" )
func (BillettholderEmailKind) Label ¶
func (kind BillettholderEmailKind) Label() string
type BillettholderUsers ¶
type BillettholderUsers struct {
BillettholderID int `json:"billettholder_id"`
UserID int `json:"user_id"`
InsertedAt DBDateTime `json:"inserted_at"`
}
type DBDateTime ¶
func NewDBDateTime ¶
func NewDBDateTime(value time.Time) DBDateTime
func (DBDateTime) Format ¶
func (dbDateTime DBDateTime) Format(layout string) string
func (DBDateTime) IsZero ¶
func (dbDateTime DBDateTime) IsZero() bool
func (DBDateTime) MarshalJSON ¶
func (dbDateTime DBDateTime) MarshalJSON() ([]byte, error)
func (*DBDateTime) Scan ¶
func (dbDateTime *DBDateTime) Scan(value any) error
func (DBDateTime) TimeOrZero ¶
func (dbDateTime DBDateTime) TimeOrZero() time.Time
func (*DBDateTime) UnmarshalJSON ¶
func (dbDateTime *DBDateTime) UnmarshalJSON(value []byte) error
type Event ¶
type Event struct {
ID string `json:"id"`
Title string `json:"title"`
Intro string `json:"intro"`
Description string `json:"description"`
System string `json:"system"`
EventType EventType `json:"event_type"`
AgeGroup AgeGroup `json:"age_group"`
Runtime Runtime `json:"runtime"`
HostName string `json:"host_name"`
UserID sql.NullInt64 `json:"user_id"`
Email string `json:"email"`
PhoneNumber string `json:"phone_number"`
MaxPlayers int `json:"max_players"`
BeginnerFriendly bool `json:"beginner_friendly"`
CanBeRunInEnglish bool `json:"can_be_run_in_english"`
Notes string `json:"notes"`
Status EventStatus `json:"status"`
CreatedAt DBDateTime `json:"created_at"`
UpdatedAt DBDateTime `json:"updated_at"`
CreatedByID sql.NullInt64 `json:"created_by_id"`
UpdatedByID sql.NullInt64 `json:"updated_by_id"`
StatusChangedByID sql.NullInt64 `json:"status_changed_by_id"`
StatusChangedAt DBDateTime `json:"status_changed_at"`
StatusChangedAction sql.NullString `json:"status_changed_action"`
}
type EventCardModel ¶
type EventCardModel struct {
Id string `json:"id"`
IsPublished bool `json:"is_published"`
Title string `json:"title"`
Intro string `json:"intro"`
Status EventStatus `json:"status"`
System string `json:"system"`
HostName string `json:"host_name"`
EventType EventType `json:"event_type"`
AgeGroup AgeGroup `json:"age_group"`
Runtime Runtime `json:"runtime"`
BeginnerFriendly bool `json:"beginner_friendly"`
CanBeRunInEnglish bool `json:"can_be_run_in_english"`
}
type EventPlayer ¶
type EventPlayer struct {
EventID string `json:"event_id"`
PuljeID string `json:"pulje_id"`
BillettholderID int `json:"billettholder_id"`
Role EventPlayerRole `json:"role"`
InsertedAt DBDateTime `json:"inserted_at"`
}
type EventPlayerRole ¶
type EventPlayerRole string
CREATE TABLE relation_events_players (
event_id TEXT NOT NULL,
pulje_id TEXT NOT NULL,
billettholder_id INTEGER NOT NULL,
role TEXT NOT NULL DEFAULT 'Player' CHECK (role IN ('Player', 'GM')),
-- inserted_at uses the DBDateTimeNowSQL default expression.
inserted_at TEXT,
PRIMARY KEY (billettholder_id, event_id, pulje_id),
FOREIGN KEY (billettholder_id) REFERENCES billettholdere (id),
FOREIGN KEY (event_id) REFERENCES events (id),
FOREIGN KEY (pulje_id) REFERENCES puljer (id)
);
const ( EventPlayerRolePlayer EventPlayerRole = "Player" EventPlayerRoleGM EventPlayerRole = "GM" )
func (EventPlayerRole) Label ¶
func (role EventPlayerRole) Label() string
type EventPulje ¶
type EventStatus ¶
type EventStatus string
const ( EventStatusDraft EventStatus = "Kladd" EventStatusSubmitted EventStatus = "Innsendt" EventStatusApproved EventStatus = "Godkjent" EventStatusArchived EventStatus = "Forkastet" EventStatusAnnounced EventStatus = "Annonsert" )
func (EventStatus) Label ¶
func (status EventStatus) Label() string
type Interest ¶
type Interest struct {
BillettholderId int `json:"billettholder_id"`
EventId string `json:"event_id"`
PuljeId string `json:"pulje_id"`
InterestLevel InterestLevel `json:"interest_level"`
CreatedAt DBDateTime `json:"created_at"`
UpdatedAt DBDateTime `json:"updated_at"`
CreatedByID sql.NullInt64 `json:"created_by_id"`
UpdatedByID sql.NullInt64 `json:"updated_by_id"`
}
type InterestLevel ¶
type InterestLevel string
const ( InterestLevelNone InterestLevel = "" InterestLevelHigh InterestLevel = "Veldig interessert" InterestLevelMedium InterestLevel = "Middels interessert" InterestLevelLow InterestLevel = "Litt interessert" )
func (InterestLevel) Label ¶
func (level InterestLevel) Label() string
func (InterestLevel) Valid ¶
func (level InterestLevel) Valid() bool
type PuljeRow ¶
type PuljeRow struct {
ID Pulje `json:"id"`
Name string `json:"name"`
Status PuljeStatus `json:"status"`
StartAt DBDateTime `json:"start_at"`
EndAt DBDateTime `json:"end_at"`
}
type PuljeStatus ¶
type PuljeStatus string
const ( PuljeStatusOpen PuljeStatus = "Open" PuljeStatusLocked PuljeStatus = "Locked" PuljeStatusCompleted PuljeStatus = "Completed" )
func (PuljeStatus) Label ¶
func (status PuljeStatus) Label() string
type RoomByPulje ¶
type RoomByPulje struct {
ID int64
Name string
RoomNumber string
AssignedEventsID []RoomEventPuljeSummary
MaxConcurrentGames int
Notes string
}
RoomByPulje is a snapshot of room delegation for a specific pulje, this is mainly used for figuring out what `max_concurrent_events` is based on a pulje, but also for the dropdown input component used in assigning rooms to an event in a pulje
func (RoomByPulje) CurrentOccupancy ¶
func (r RoomByPulje) CurrentOccupancy() int
Helper function for getting currently assigned events to a room in a pulje
func (RoomByPulje) IsFull ¶
func (r RoomByPulje) IsFull() bool
Helper function for quickly checking if a room is full in a pulje
func (RoomByPulje) RemainingCapacity ¶
func (r RoomByPulje) RemainingCapacity() int
Helper function for getting available free slots for a room in a pulje
type RoomEventPuljeSummary ¶
RoomEventPuljeSummary is the summary of an event in `relation_event_puljer` and used in `RoomByPulje` struct
- `EventPuljeID` is the ID of the unique event in a pulje
- `EventID` is the ID of the pulje the unique event is in
- `Title` is the title of the event
type RoomInput ¶
type RoomInput struct {
ID int
Name *string
RoomNumber *string
Floor *int
MaxConcurrentGames *int
Notes *string
IsDisabled *bool
}
Normalized version of `Room` type for use when updating a room, or quering for a specific room with optional params
type RoomStatusByPulje ¶
type RoomStatusByPulje = map[Pulje]map[int64]RoomByPulje
RoomStatusByPulje is a map of puljer containing room statuses, such as which games are assigned to that room You can access status by keys: Pulje[RoomID]
type RoomStatusRow ¶
type RoomStatusRow struct {
PuljeID Pulje
RoomID int64
RoomName string
RoomNumber string
MaxConcurrentGames int
RoomNotes string
EventID sql.NullString
EventTitle sql.NullString
}