feat: use upsert for otp + implement otp methods for cassandradb

This commit is contained in:
Lakhan Samani
2022-07-23 16:39:35 +05:30
parent 22ae3bca54
commit f6029fb7bf
7 changed files with 86 additions and 82 deletions

View File

@@ -2,23 +2,13 @@ package provider_template
import (
"context"
"time"
"github.com/authorizerdev/authorizer/server/db/models"
"github.com/google/uuid"
)
// AddOTP to add otp
func (p *provider) AddOTP(ctx context.Context, otp *models.OTP) (*models.OTP, error) {
if otp.ID == "" {
otp.ID = uuid.New().String()
}
otp.Key = otp.ID
otp.CreatedAt = time.Now().Unix()
otp.UpdatedAt = time.Now().Unix()
return otp, nil
// UpsertOTP to add or update otp
func (p *provider) UpsertOTP(ctx context.Context, otp *models.OTP) (*models.OTP, error) {
return nil, nil
}
// GetOTPByEmail to get otp for a given email address