model

package
v0.0.0-...-5b6618e Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USERS_ROLE_SUPER_ADMIN = "super_admin"
	USERS_ROLE_ADMIN       = "admin"
	USERS_ROLE_USER        = "user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OrgAdmin

type OrgAdmin struct {
	OrganizationID, UserID uint
}

type Organization

type Organization struct {
	gorm.Model
	Name        string `gorm:"not null; unique" json:"name"`
	Address     string `gorm:"not null" json:"address"`
	PhoneNumber string `gorm:"not null" json:"phone_number"`
	WebsiteUrl  string `json:"website_url"`
	Admins      []User `gorm:"many2many:org_admins"`
	Tickets     []Ticket
}

type Ticket

type Ticket struct {
	gorm.Model
	UserID         uint   `gorm:"not null" json:"user_id"`
	OrganizationID uint   `gorm:"not null" json:"org_id"`
	Title          string `gorm:"not null" json:"title"`
	Body           string `gorm:"not null" json:"body"`
	WebsiteURL     string `json:"website_url"`
	AttachmentUrl  string `json:"attachment_url"`
	Seen           bool   `gorm:"default:false" json:"seen"`
	User           *User
	Organization   *Organization
}

type User

type User struct {
	gorm.Model
	Username      string         `gorm:"not null; unique" json:"username"`
	Email         string         `gorm:"not null; unique" json:"email"`
	Password      string         `gorm:"not null" json:"password,omitempty"`
	Role          string         `gorm:"default:user" json:"role"`
	Blocked       bool           `gorm:"default:false" json:"blocked"`
	Verified      bool           `gorm:"default:true" json:"verified"`
	Organizations []Organization `gorm:"many2many:org_admins"`
}

Jump to

Keyboard shortcuts

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