first commit
This commit is contained in:
36
internal/modules/user/model.go
Normal file
36
internal/modules/user/model.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package user
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
RoleSuperAdmin = "superadmin"
|
||||
RoleAdmin = "admin"
|
||||
RoleUser = "user"
|
||||
|
||||
StatusActive = "active"
|
||||
StatusSuspended = "suspended"
|
||||
StatusUnverified = "unverified"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
Name string `json:"name" gorm:"type:varchar(100);not null"`
|
||||
Email string `json:"email" gorm:"type:varchar(150);uniqueIndex;not null"`
|
||||
Password string `json:"-" gorm:"type:varchar(255)"`
|
||||
GoogleID *string `json:"google_id,omitempty" gorm:"type:varchar(255);uniqueIndex;default:null"`
|
||||
AvatarURL *string `json:"avatar_url,omitempty" gorm:"type:varchar(500);default:null"`
|
||||
Role string `json:"role" gorm:"type:varchar(30);not null;default:'user';index"`
|
||||
Status string `json:"status" gorm:"type:varchar(30);not null;default:'active';index"`
|
||||
IsEmailVerified bool `json:"is_email_verified" gorm:"default:false"`
|
||||
VerificationToken string `json:"-" gorm:"type:varchar(255)"`
|
||||
ResetPasswordToken string `json:"-" gorm:"type:varchar(255)"`
|
||||
ResetPasswordExpiresAt *time.Time `json:"-"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||
CreatedBy *uint `json:"created_by" gorm:"default:null"`
|
||||
UpdatedBy *uint `json:"updated_by" gorm:"default:null"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
return "users"
|
||||
}
|
||||
Reference in New Issue
Block a user