40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Role struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
Code string `gorm:"uniqueIndex;not null" json:"code"`
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
func (Role) TableName() string { return "roles" }
|
|
|
|
type Permission struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
|
|
Code string `gorm:"uniqueIndex;not null" json:"code"`
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
func (Permission) TableName() string { return "permissions" }
|
|
|
|
type Position struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
Code string `gorm:"uniqueIndex" json:"code"`
|
|
Path string `gorm:"type:ltree;uniqueIndex" json:"path"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
}
|
|
|
|
func (Position) TableName() string { return "positions" }
|