// models/email.go package models import ( "time" "gorm.io/gorm" ) type EmailVerification struct { ID uint `json:"id" gorm:"primaryKey"` UserID uint `json:"user_id" gorm:"not null;index"` Token string `json:"token" gorm:"size:100;not null;uniqueIndex"` Email string `json:"email" gorm:"not null"` Type string `json:"type" gorm:"size:20;not null"` // verification, password_reset ExpiresAt time.Time `json:"expires_at" gorm:"not null"` Used bool `json:"used" gorm:"default:false"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` // Связи User User `gorm:"foreignKey:UserID" json:"user,omitempty"` } type PasswordResetRequest struct { Email string `json:"email" validate:"required,email"` } type PasswordResetConfirm struct { Token string `json:"token" validate:"required"` Password string `json:"password" validate:"required,min=6"` }