package models import ( "time" "gorm.io/gorm" ) // PasswordReset stores password reset tokens, verification codes, and their status type PasswordReset struct { gorm.Model UserID uint `gorm:"index;not null" json:"user_id"` User User `gorm:"foreignKey:UserID" json:"-"` Token string `gorm:"uniqueIndex;size:128;not null" json:"token"` ExpiresAt time.Time `gorm:"index;not null" json:"expires_at"` UsedAt *time.Time `json:"used_at"` IP string `json:"ip"` UserAgent string `json:"user_agent"` VerificationCode string `gorm:"size:6" json:"-"` VerificationCodeExpires *time.Time `json:"verification_code_expires_at"` VerificationAttempts int `gorm:"default:0" json:"verification_attempts"` } func (PasswordReset) TableName() string { return "password_resets" }