model

package
v0.0.0-...-a859ae6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DBConn *gorm.DB
)

Functions

func InitDB

func InitDB(dialect string, host string, port string, user string, pass string, database string, options string)

Types

type Category

type Category struct {
	ID          uint   `gorm:"primary_key" json:"id"`
	Title       string `gorm:"type:varchar(25);unique_index" json:"title"`
	Description string `gorm:"type:varchar(140)" json:"description"`
}

type Password

type Password struct {
	PersonID uint8  `json:"-"`
	Person   Person `gorm:"foreignkey:PersonID"`
	Hash     string `gorm:"type:char(61)"`
	Created  time.Time
}

type Person

type Person struct {
	ID            uint      `gorm:"primary_key" json:"id"`
	FirstName     string    `gorm:"type:varchar(50)" json:"first_name"`
	LastName      string    `gorm:"type:varchar(50);not null" json:"last_name"`
	Username      string    `gorm:"type:varchar(20);not null;unique_index" json:"username"`
	Email         string    `gorm:"type:varchar(128);not null;unique_index" json:"email"`
	Phone         string    `gorm:"type:varchar(13);not null" json:"phone"`
	Password      string    `gorm:"type:varchar(255)" json:"-"` // use json:"-" to prevent it from being returned, this is an internal-only field
	Created       time.Time `json:"created"`
	Deleted       bool      `gorm:"type:tinyint(1);default:0" json:"deleted"`
	EmailVerified bool      `gorm:"type:tinyint(1);default:0" json:"email_verified"`
	Locked        bool      `gorm:"type:tinyint(1);default:0" json:"locked"`
}

type Queue

type Queue struct {
	ID          uint   `gorm:"primary_key" json:"id"`
	Title       string `gorm:"type:varchar(25);not null;unique_index" json:"title"`
	Description string `gorm:"type:varchar(140)" json:"description"`
}

type Reply

type Reply struct {
	ID           uuid.UUID `gorm:"type:binary(16);primaryKey" json:"id"`
	Person       Person    `gorm:"foreignkey:PersonID" json:"-"`
	PersonID     uint      `json:"person_id"`
	ParentTicket Ticket    `gorm:"foreignkey:TicketID" json:"-"`
	TicketID     uint      `json:"ticket_id"`
	Body         string    `gorm:"type:text;not null" json:"body"`
	Created      time.Time `json:"created"`
	Deleted      bool      `gorm:"type:tinyint(1);default:0" json:"deleted"`
	Internal     bool      `gorm:"type:tinyint(1);default:0" json:"internal"`
}

func (*Reply) BeforeCreate

func (r *Reply) BeforeCreate(tx *gorm.DB) (err error)

type SLA

type SLA struct {
	ID          uint   `gorm:"primary_key" json:"id"`
	Title       string `gorm:"type:varchar(25);not null;unique_index" json:"title"`
	Description string `gorm:"type:varchar(140)" json:"description"`
	Weight      string `gorm:"type:decimal(4,2);unsigned;default:48.00" json:"weight"`
}

type Status

type Status struct {
	ID          uint   `gorm:"primary_key" json:"id"`
	Title       string `gorm:"type:varchar(25);unique_index;not null" json:"title"`
	Description string `gorm:"type:varchar(140)" json:"description"`
}

type Ticket

type Ticket struct {
	ID               uint     `gorm:"primary_key" json:"id"`
	OwnerID          uint     `json:"owner_id"`
	Owner            Person   `json:"-"`
	AffectedPersonID uint     `json:"affected_person_id"`
	AffectedPerson   Person   `json:"-"`
	QueueID          uint     `json:"queue_id"`
	Queue            Queue    `json:"-"`
	SlaID            uint     `json:"sla_id"`
	Sla              SLA      `json:"-"'`
	StatusID         uint     `json:"status_id"`
	Status           Status   `json:"-"`
	CategoryID       uint     `json:"category_id"`
	Category         Category `json:"-"`
	Subject          string   `gorm:"type:varchar(78)" json:"subject"`
	Body             string   `gorm:"type:text" json:"body"`
	Locked           bool     `gorm:"type:tinyint(1);default:0" json:"locked"`
}

Jump to

Keyboard shortcuts

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