Initial commit: 商品售卖网站
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"uniqueIndex;size:50;not null" json:"username"`
|
||||
Email string `gorm:"uniqueIndex;size:100;not null" json:"email"`
|
||||
PasswordHash string `gorm:"size:255;not null" json:"-"`
|
||||
Role string `gorm:"size:20;not null;default:'user'" json:"role"`
|
||||
PurchaseCredits int `gorm:"default:0" json:"purchase_credits"`
|
||||
InviteCode string `gorm:"uniqueIndex;size:20" json:"invite_code"`
|
||||
ReferredBy *uint `json:"referred_by"`
|
||||
EmailVerified bool `gorm:"default:false" json:"email_verified"`
|
||||
IsActive bool `gorm:"default:true" json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
return "users"
|
||||
}
|
||||
Reference in New Issue
Block a user