Files
JuYou/API/internal/model/web.go
T
2026-08-25 17:59:42 +08:00

40 lines
1.3 KiB
Go

package model
import (
"time"
"github.com/google/uuid"
"gorm.io/gorm"
)
type WebUser struct {
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
UID string `json:"uid"`
Username string `json:"username"`
Account string `json:"account"`
AvatarURL string `json:"avatar_url"`
AvatarKey string `json:"-"`
PasswordHash string `json:"-"`
PointBalance string `gorm:"column:point_balance" json:"point_balance"`
DailyLimit string `json:"daily_limit"`
Enabled bool `json:"enabled"`
SessionVersion int64 `json:"-"`
LastOnlineAt *time.Time `json:"last_online_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"-"`
}
type WebRefreshToken struct {
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey"`
UserID uuid.UUID `gorm:"type:uuid"`
TokenHash string
SessionVersion int64
ExpiresAt time.Time
RevokedAt *time.Time
CreatedAt time.Time
}
func (WebUser) TableName() string { return "web_users" }
func (WebRefreshToken) TableName() string { return "web_refresh_tokens" }