Files
SeeyonFileSystem/server/model/user.go
2026-07-03 15:58:29 +08:00

29 lines
1.1 KiB
Go

// Package model 定义数据模型
package model
import "time"
// User 用户模型
// 对应数据库表: fs_user
type User struct {
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
Username string `json:"username" gorm:"uniqueIndex;size:64;not null"`
Password string `json:"-" gorm:"size:256;not null"` // json:"-" 防止密码泄露
Email string `json:"email" gorm:"size:128"`
Nickname string `json:"nickname" gorm:"size:64"`
Avatar string `json:"avatar" gorm:"size:512"`
Role string `json:"role" gorm:"size:32;default:user"`
Status int8 `json:"status" gorm:"default:1"`
DeptID uint64 `json:"dept_id" gorm:"index;default:0"`
StorageQuota int64 `json:"storage_quota" gorm:"default:10737418240"`
UsedStorage int64 `json:"used_storage" gorm:"default:0"`
MustChangePwd int8 `json:"must_change_pwd" gorm:"default:0"` // 1=首次登录必须改密码
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// TableName 指定表名
func (User) TableName() string {
return "fs_user"
}