26 lines
635 B
Go
26 lines
635 B
Go
package role
|
|
|
|
import "time"
|
|
|
|
// Role đại diện cho một vai trò trong hệ thống
|
|
type Role struct {
|
|
ID int `json:"id" gorm:"primaryKey"`
|
|
Name string `json:"name" gorm:"size:50;uniqueIndex;not null"`
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
|
}
|
|
|
|
// TableName specifies the table name for the Role model
|
|
func (Role) TableName() string {
|
|
return "roles"
|
|
}
|
|
|
|
// Constants for role names
|
|
const (
|
|
Admin = "admin"
|
|
Manager = "manager"
|
|
User = "user"
|
|
Guest = "guest"
|
|
)
|