models

package
v0.0.0-...-0372559 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 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 Attachment

type Attachment struct {
	gorm.Model
	CardID  uint
	FileURL string `gorm:"not null"`
}

type Board

type Board struct {
	gorm.Model
	OwnerID     uint          `gorm:"index;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Title       string        `gorm:"not null"`
	Description string        `gorm:"type:text;not null"`
	Members     []BoardMember `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Lists       []List        `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Labels      []Label       `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type BoardMember

type BoardMember struct {
	gorm.Model
	UserID      uint `gorm:"index;not null"`
	BoardID     uint `gorm:"index;not null"`
	BoardRoleID uint
	BoardRole   BoardRole `gorm:"not null;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
}

type BoardRole

type BoardRole struct {
	gorm.Model
	Title       string       `gorm:"unique;not null"`
	Permissions pgtype.JSONB `gorm:"type:jsonb;not null"`
}

type Card

type Card struct {
	gorm.Model
	ListID      uint   `gorm:"index;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Title       string `gorm:"not null"`
	Content     string `gorm:"type:text"`
	Order       int    `gorm:"not null"`
	Completed   bool   `gorm:"default:false"`
	DueDate     sql.NullTime
	Attachments []Attachment   `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Comments    []Comment      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Assignments []CardAssignee `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Labels      []Label        `gorm:"many2many:card_labels;"`
}

type CardAssignee

type CardAssignee struct {
	gorm.Model
	UserID uint `gorm:"index;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	CardID uint `gorm:"index;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type Comment

type Comment struct {
	gorm.Model
	CardID uint   `gorm:"index;not null"`
	UserID uint   `gorm:"index;not null"`
	Text   string `gorm:"type:text;not null"`
}

type Label

type Label struct {
	gorm.Model
	BoardID uint   `gorm:"index;not null"`
	Title   string `gorm:"not null"`
	Color   string `gorm:"not null"`
	Cards   []Card `gorm:"many2many:card_labels;"`
}

type List

type List struct {
	gorm.Model
	BoardID uint   `gorm:"index;not null;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Title   string `gorm:"not null"`
	Order   int    `gorm:"not null"`
	Cards   []Card `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type Password

type Password struct {
	gorm.Model
	UserID    uint   `gorm:"index;unique;not null;onDelete:CASCADE;onUpdate:CASCADE"`
	Hash      []byte `gorm:"type:bytea;not null"`
	Salt      []byte `gorm:"type:bytea;not null"`
	Algorithm string `gorm:"not null"`
}

type Role

type Role struct {
	gorm.Model
	Title       string       `gorm:"unique;not null"`
	Permissions pgtype.JSONB `gorm:"type:jsonb;not null"`
}

type User

type User struct {
	gorm.Model
	Username    string `gorm:"not null"`
	Email       string `gorm:"unique;not null"`
	RoleID      uint
	Role        Role           `gorm:"not null;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
	Password    Password       `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Boards      []Board        `gorm:"foreignKey:OwnerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Memberships []BoardMember  `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Comments    []Comment      `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Assignments []CardAssignee `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

Jump to

Keyboard shortcuts

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