models

package
v0.0.0-...-5738a8d Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DBDateTimeNowSQL = "strftime('%Y-%m-%dT%H:%M:%fZ', 'now')"

Variables

This section is empty.

Functions

func ValidPuljeValues

func ValidPuljeValues() []string

Types

type AgeGroup

type AgeGroup string
const (
	AgeGroupDefault       AgeGroup = "Default"
	AgeGroupChildFriendly AgeGroup = "ChildFriendly"
	AgeGroupAdultsOnly    AgeGroup = "AdultsOnly"
)

func (AgeGroup) BadgeLabel

func (ageGroup AgeGroup) BadgeLabel() string

func (AgeGroup) Label

func (ageGroup AgeGroup) Label() string

func (AgeGroup) Valid

func (ageGroup AgeGroup) Valid() bool

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

type DBDateTime struct {
	Time  time.Time
	Valid bool
}

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

func (DBDateTime) Value

func (dbDateTime DBDateTime) Value() (driver.Value, 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 EventPulje struct {
	EventID     string        `json:"event_id"`
	PuljeID     Pulje         `json:"pulje_id"`
	IsInPulje   bool          `json:"isInPulje"`
	IsPublished bool          `json:"isPublished"`
	RoomID      sql.NullInt64 `json:"room_id"`
}

type EventStatus

type EventStatus string
const (
	EventStatusDraft     EventStatus = "Kladd"
	EventStatusSubmitted EventStatus = "Innsendt"
	EventStatusApproved  EventStatus = "Godkjent"
	EventStatusArchived  EventStatus = "Forkastet"
	EventStatusPublished EventStatus = "Publisert"
)

func (EventStatus) Label

func (status EventStatus) Label() string

type EventType

type EventType string
const (
	EventTypeRoleplay  EventType = "Roleplay"
	EventTypeBoardGame EventType = "Boardgame"
	EventTypeCardGame  EventType = "Cardgame"
	EventTypeOther     EventType = "Other"
)

func (EventType) Label

func (eventType EventType) 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 Pulje

type Pulje string
const (
	PuljeFredagKveld  Pulje = "FredagKveld"
	PuljeLordagMorgen Pulje = "LordagMorgen"
	PuljeLordagKveld  Pulje = "LordagKveld"
	PuljeSondagMorgen Pulje = "SondagMorgen"
)

func AllPuljer

func AllPuljer() []Pulje

func ParsePulje

func ParsePulje(s string) (Pulje, 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"`
}

func (PuljeRow) TimeRange

func (pulje PuljeRow) TimeRange() string

type PuljeStatus

type PuljeStatus string
const (
	PuljeStatusOpen         PuljeStatus = "open"
	PuljeStatusNotPublished PuljeStatus = "not_published"
	PuljeStatusPublished    PuljeStatus = "published"
	PuljeStatusLocked       PuljeStatus = "locked"
	PuljeStatusCompleted    PuljeStatus = "completed"
)

func (PuljeStatus) Label

func (status PuljeStatus) Label() string

type Runtime

type Runtime string
const (
	RunTimeNormal       Runtime = "Normal"
	RunTimeShortRunning Runtime = "ShortRunning"
	RunTimeLongRunning  Runtime = "LongRunning"
)

func (Runtime) BadgeLabel

func (runtime Runtime) BadgeLabel() string

func (Runtime) Label

func (runtime Runtime) Label() string

func (Runtime) Valid

func (runtime Runtime) Valid() bool

type User

type User struct {
	ID         int        `json:"id"`
	ExternalID string     `json:"external_id"`
	Email      string     `json:"email"`
	IsAdmin    bool       `json:"is_admin"`
	InsertedAt DBDateTime `json:"inserted_at,omitempty"`
}

Jump to

Keyboard shortcuts

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