models

package
v0.0.0-...-bcbc1e1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 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 BaseModel

type BaseModel struct {
	// ID should use uuid_generate_v4() for the PK's
	ID        uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"`
	CreatedAt time.Time `gorm:"index;not null;default:CURRENT_TIMESTAMP"`
	UpdatedAt time.Time `gorm:"index;not null;default:CURRENT_TIMESTAMP"`
}

BaseModel defines the common columns that all db structs hold usually, db structs based on this have no soft delete

type BaseModelSoftDelete

type BaseModelSoftDelete struct {
	BaseModel
	DeletedAt *time.Time `sql:"index"`
}

BaseModelSoftDelete defines the common columns that all db structs should hold. This struct also defines the fields for GORM triggers to detect if the entity should soft delete

type Commission

type Commission struct {
	BaseModelSoftDelete
	Artist   *User
	ArtistID uuid.UUID
	Patron   *User
	PatronID uuid.UUID
	Status   model.Status
	Minis    []*CommissionedMini
	Total    float64
}

Commission type represents commissions in the database

type CommissionedMini

type CommissionedMini struct {
	BaseModelSoftDelete
	Name         string
	Size         model.MiniSize
	Price        float64
	Quantity     int
	Notes        string
	Commission   *Commission
	CommissionID uuid.UUID
}

CommissionedMini belongs to a Commission

type Game

type Game struct {
	BaseModelSoftDelete
	Name  string
	Minis []*GameMini
}

Game has many GameMinis

type GameMini

type GameMini struct {
	BaseModelSoftDelete
	Name   string
	Size   model.MiniSize
	Game   *Game
	GameID uuid.UUID
}

GameMini belongs to Game, GameID is the foreign key

type MiniConfig

type MiniConfig struct {
	BaseModelSoftDelete
	Name   string
	Size   model.MiniSize
	Price  float64
	User   *User
	UserID uuid.UUID
	Mini   *GameMini
	MiniID uuid.UUID
}

type Socials

type Socials struct {
	BaseModelSoftDelete
	User      User
	UserID    uuid.UUID
	Facebook  *string
	Instagram *string
	Twitch    *string
	Twitter   *string
}

Socials is a container to hold links to various social media stuff

type User

type User struct {
	BaseModelSoftDelete
	Email    string  `gorm:"not null; unique_index:idx_email"`
	UserID   *string // external user ID
	Name     *string
	NickName *string `gorm:"not null; unique_index:idx_nickname"`
	Picture  *string
	ForHire  bool `gorm:"not null; default:false"`
	Socials  *Socials
}

User defines a user for the app

Jump to

Keyboard shortcuts

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