24 lines
725 B
Go
24 lines
725 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type User struct {
|
|
ID uint64 `gorm:"primaryKey;autoIncrement:false" json:"id"`
|
|
Username string `gorm:"unique;not null" json:"username"`
|
|
Active bool `json:"active"`
|
|
RateLimitID uint32 `json:"rate_limit_id"`
|
|
RateLimit RateLimit `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"rate_limit"`
|
|
// Many-to-many relation with Permission
|
|
Permissions []Permission `gorm:"many2many:user_permissions;" json:"permissions"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type UserRole struct {
|
|
ID string `json:"id"`
|
|
DisplayName string `json:"display_name"`
|
|
Rank int32 `json:"rank"`
|
|
}
|