update: verify otp resolver and test added

This commit is contained in:
anik-ghosh-au7
2022-07-23 18:32:31 +05:30
parent 5d903ca170
commit 49cc6033ab
6 changed files with 153 additions and 11 deletions

View File

@@ -32,13 +32,13 @@ func (p *provider) UpsertOTP(ctx context.Context, otp *models.OTP) (*models.OTP,
// GetOTPByEmail to get otp for a given email address
func (p *provider) GetOTPByEmail(ctx context.Context, emailAddress string) (*models.OTP, error) {
var otp *models.OTP
var otp models.OTP
result := p.db.Where("email = ?", emailAddress).First(otp)
result := p.db.Where("email = ?", emailAddress).First(&otp)
if result.Error != nil {
return nil, result.Error
}
return otp, nil
return &otp, nil
}
// DeleteOTP to delete otp