mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-23 06:42:41 +00:00
new user.go v2.0
This commit is contained in:
parent
0e28f2b178
commit
1aad1ef359
1 changed files with 7 additions and 11 deletions
|
|
@ -1,15 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
// ВАЖНО: имена полей ДОЛЖНЫ остаться такими,
|
||||||
"time"
|
// потому что их использует остальной код: Id, Username, PasswordHash, Role.
|
||||||
)
|
|
||||||
|
|
||||||
// User represents a panel user with RBAC role.
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int `json:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
Email string `json:"email" gorm:"unique;not null"`
|
Username string `json:"username" gorm:"uniqueIndex;not null"`
|
||||||
Password string `json:"-" gorm:"not null"`
|
Password string `json:"-"` // может использоваться для приема сырого пароля (не храним)
|
||||||
Role string `json:"role" gorm:"default:'reader'"`
|
PasswordHash string `json:"-" gorm:"column:password_hash"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
Role string `json:"role" gorm:"not null"` // admin | moder | reader
|
||||||
UpdatedAt time.Time `json:"updated_at"`
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue