model

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

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

Go to latest
Published: Nov 22, 2024 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Key   string `json:"key"`
	Owner string `json:"owner"`

	EnabledKeyManage   int `json:"enabled_key_manage"   gorm:"default:-1"`
	EnabledAuth        int `json:"enabled_auth"         gorm:"default:-1"`
	EnabledSearch      int `json:"enabled_search"       gorm:"default:-1"`
	EnabledUserFetch   int `json:"enabled_user_fetch"   gorm:"default:-1"`
	EnabledUserActions int `json:"enabled_user_actions" gorm:"default:-1"`
	EnabledProjects    int `json:"enabled_projects"     gorm:"default:-1"`

	TimesUsed uint `json:"times_used" gorm:"default:0"`
	MaxUsage  uint `json:"max_usage"  gorm:"default:0"`
}

type Component

type Component struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Name        string `gorm:"not null"`
	Description string `gorm:"default:''"`

	Content any `gorm:"type:jsonb;not null"`

	Price  int `gorm:"default:0"`
	Budget int `gorm:"default:0"`
}

type ComponentHolder

type ComponentHolder struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ComponentID uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`
	UserID      uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`

	PricePaid int `gorm:"default:0"`
}

type ComponentOwner

type ComponentOwner struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ComponentID uint  `gorm:"index;unique;not null;constraint:OnDelete:CASCADE;"`
	UserID      *uint `gorm:"index;constraint:OnDelete:CASCADE;"`
}

type ComponentPublication

type ComponentPublication struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ComponentID uint `gorm:"index;unique;not null;constraint:OnDelete:CASCADE;"`
}

type Follower

type Follower struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	FollowingID uint `gorm:"index"`
	FollowerID  uint `gorm:"index"`

	Since time.Time `gorm:"autoCreateTime"`
}

type Notification

type Notification struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Title   string
	Message string

	Type notification.NotificationType `gorm:"type:notification_type;default:'information'"`

	Redirect *string
}

type NotificationUser

type NotificationUser struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	NotificationID uint `gorm:"not null;index"`
	UserID         uint `gorm:"not null;index"`
}

type NotificationUserRead

type NotificationUserRead struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	NotificationID uint `gorm:"not null;index"`
	UserID         uint `gorm:"not null;index"`
}

type PasswordResetKey

type PasswordResetKey struct {
	Key    uuid.UUID `gorm:"primarykey;type:uuid;default:gen_random_uuid()"`
	UserID uint      `gorm:"unique;not null"`

	ExpiresAt time.Time `gorm:"not null"`
}

func (*PasswordResetKey) BeforeCreate

func (p *PasswordResetKey) BeforeCreate(tx *gorm.DB) (err error)

type Permission

type Permission struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Name string `gorm:"unique"`
}

type Project

type Project struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Name        string `gorm:"not null"`
	Description string `gorm:"default:''"`

	BannerURL string `gorm:"default:''"`

	Width  int `gorm:"not null;default:30"`
	Height int `gorm:"not null;default:30"`

	Content any `gorm:"type:jsonb;not null;default:'{}'"`
	Budget  int `gorm:"default:0"`

	Fork *uint `gorm:"index"`
}

type ProjectOwner

type ProjectOwner struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ProjectID uint `gorm:"unique;index;not null;constraint:OnDelete:CASCADE;"`
	UserID    uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`
}

type ProjectPublication

type ProjectPublication struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ProjectID uint `gorm:"unique;index;not null;constraint:OnDelete:CASCADE;"`
}

type ProjectUserFavorite

type ProjectUserFavorite struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ProjectID uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`
	UserID    uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`
}

type ProjectUserPermission

type ProjectUserPermission struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ProjectID uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`
	UserID    uint `gorm:"index;not null;constraint:OnDelete:CASCADE;"`

	Allow dto.Allow `gorm:"embedded;embeddedPrefix:allow_"`
}

type User

type User struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	FirstName string
	LastName  string
	Bio       string
	Verified  bool

	Username string `gorm:"unique"`
	Email    string `gorm:"unique"`
	Password string

	XP      uint64 `gorm:"default:500"`
	Arkhoin uint64 `gorm:"default:1000"`

	Notification struct {
		InApp bool `gorm:"default:true"`
		Email bool `gorm:"default:false"`
	} `gorm:"embedded;embeddedPrefix:notify_"`

	Show struct {
		Profile    bool `gorm:"default:true"`
		Image      bool `gorm:"default:true"`
		Comments   bool `gorm:"default:true"`
		Favorites  bool `gorm:"default:true"`
		Projects   bool `gorm:"default:true"`
		Components bool `gorm:"default:true"`
		Followers  bool `gorm:"default:true"`
		Following  bool `gorm:"default:true"`
		Inventory  bool `gorm:"default:false"`
		Formations bool `gorm:"default:true"`
	} `gorm:"embedded;embeddedPrefix:show_"`

	Country string

	Language language.Language `gorm:"type:enum_language;default:pt"`

	ProfilePicture string
}

type UserPermission

type UserPermission struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time

	UserID       uint `gorm:"Index"`
	PermissionID uint `gorm:"Index"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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