types

package
v0.0.0-...-53ff5f4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"access_token"`
}

type Account

type Account struct {
	Model
	Code     uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();unique"`
	Services []Service `gorm:"many2many:service_accounts;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Name     string
}

type CustomClaims

type CustomClaims struct {
	jwt.RegisteredClaims
	Access access.Access `json:"access"`
}

type Model

type Model struct {
	ID        uint32 `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type Permission

type Permission struct {
	Model
	ServiceID uint32
	Name      string
	Access    access.Access
	Users     []User `gorm:"many2many:user_permissions;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type Service

type Service struct {
	Model
	Name        string       `gorm:"unique"`
	Code        uuid.UUID    `gorm:"type:uuid;default:gen_random_uuid();unique"`
	Accounts    []Account    `gorm:"many2many:service_accounts;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Permissions []Permission `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type User

type User struct {
	Model
	Code       uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();unique"`
	Name       string    `gorm:"size:32;unique" json:"name"`
	Password   []byte    `gorm:"size:60" json:"password"`
	TGName     string    `gorm:"size:128" json:"tg_name"`
	TGID       uint64    `gorm:"unique" json:"tg_id"`
	TGUserName string    `gorm:"size:32;unique" json:"tg_user_name"`
	//Access      access.Access `json:"access"`
	ParentID    uint32 `gorm:"default:null"`
	Parent      *User
	AccountID   uint32
	Account     Account
	Blocked     bool
	Permissions []Permission `gorm:"many2many:user_permissions;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

Jump to

Keyboard shortcuts

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