package auth import ( "time" "gorm.io/gorm" "wucher/internal/shared/pkg/uuidv7" ) type UserTOTP struct { ID []byte `gorm:"type:binary(16);primaryKey;column:id"` UserID []byte `gorm:"type:binary(16);uniqueIndex;not null;column:user_id"` SecretEncrypted []byte `gorm:"type:varbinary(512);not null;column:secret_encrypted"` Enabled bool `gorm:"type:tinyint(1);not null;default:0;column:enabled"` LastUsedAt *time.Time `gorm:"column:last_used_at"` CreatedAt time.Time CreatedBy []byte `gorm:"type:binary(16);column:created_by"` UpdatedAt time.Time UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"` } func (UserTOTP) TableName() string { return "user_totp" } func (ut *UserTOTP) BeforeCreate(tx *gorm.DB) error { if len(ut.ID) == 0 { ut.ID = uuidv7.MustBytes() } return nil }