feat: user auth.
This commit is contained in:
+12
-11
@@ -35,17 +35,18 @@ type UserRegionBinding struct {
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"uniqueIndex;not null" json:"username"`
|
||||
Email *string `gorm:"uniqueIndex;" json:"email"`
|
||||
Phone *string `gorm:"uniqueIndex;" json:"phone"`
|
||||
Password string `gorm:"not null" json:"-"`
|
||||
Role UserRole `gorm:"type:varchar(32);not null;default:'viewer';index" json:"role"`
|
||||
FlavorType UserFlavorType `gorm:"type:varchar(32);not null;default:'all';index" json:"flavorType"`
|
||||
IsActive bool `gorm:"not null;default:true;index" json:"isActive"`
|
||||
Regions []UserRegionBinding `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE" json:"regions"`
|
||||
CreatedAt int64 `gorm:"not null" json:"created_at"`
|
||||
UpdatedAt int64 `gorm:"not null" json:"updated_at"`
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"uniqueIndex;not null" json:"username"`
|
||||
Email *string `gorm:"uniqueIndex;" json:"email"`
|
||||
Phone *string `gorm:"uniqueIndex;" json:"phone"`
|
||||
Password string `gorm:"not null" json:"-"`
|
||||
Role UserRole `gorm:"type:varchar(32);not null;default:'viewer';index" json:"role"`
|
||||
FlavorType UserFlavorType `gorm:"type:varchar(32);not null;default:'all';index" json:"flavorType"`
|
||||
IsActive bool `gorm:"not null;default:true;index" json:"isActive"`
|
||||
TokenInvalidBefore int64 `gorm:"not null;default:0" json:"tokenInvalidBefore"`
|
||||
Regions []UserRegionBinding `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE" json:"regions"`
|
||||
CreatedAt int64 `gorm:"not null" json:"created_at"`
|
||||
UpdatedAt int64 `gorm:"not null" json:"updated_at"`
|
||||
}
|
||||
|
||||
// HashPassword 密码加密
|
||||
|
||||
Reference in New Issue
Block a user