Files
LokiStack/backend/models/user.go
T
opsx 4f74fe6c3f
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s
ci(engineering): Gitea Actions 门禁 + 前端测试设施 + 版本注入修复
- .gitea/workflows/ci.yml:后端 gofmt/vet/test + 前端 lint/test/build 双 job 门禁
- vitest + @testing-library + jsdom 落地,14 个命脉用例:useListQuery 乱序丢弃/卸载中止、
  http.ts 401 单飞刷新+队列重放+失败登出+silent 直拒、审计防抖、StepDeploy 部署目标、query-utils
- 版本注入断裂修复:main 补 buildTime/gitCommit 符号,build.sh/Dockerfile 注入 main.version,
  /health 返回真实版本,前端 package.json 版本对齐 2.0.0
- gofmt 清零(8 个存量未格式化文件)
2026-10-29 13:02:19 +08:00

30 lines
886 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "time"
// User TokenVersion 用于服务端会话吊销:改密/管理员重置密码时递增,
// 旧 token(access 与 refresh)随版本不匹配立即失效。
type User struct {
ID uint `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
Nickname string `json:"nickname"`
Role string `json:"role"`
AuthSource string `json:"authSource"` // local | ldap
TokenVersion int `json:"tokenVersion"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (u *User) Sanitized() map[string]interface{} {
return map[string]interface{}{
"id": u.ID,
"username": u.Username,
"nickname": u.Nickname,
"role": u.Role,
"authSource": u.AuthSource,
"createdAt": u.CreatedAt,
"updatedAt": u.UpdatedAt,
}
}