Refactor code for otp

This commit is contained in:
Lakhan Samani
2023-07-13 11:39:22 +05:30
committed by catusax
parent 85ca0f09bf
commit 2f849b8f0c
33 changed files with 277 additions and 696 deletions

View File

@@ -233,22 +233,7 @@ func NewProvider() (*provider, error) {
Unique: true,
Sparse: true,
})
smsVerificationCollectionExists, err := arangodb.CollectionExists(ctx, models.Collections.SMSVerificationRequest)
if err != nil {
return nil, err
}
if !smsVerificationCollectionExists {
_, err = arangodb.CreateCollection(ctx, models.Collections.SMSVerificationRequest, nil)
if err != nil {
return nil, err
}
}
smsVerificationCollection, err := arangodb.Collection(ctx, models.Collections.SMSVerificationRequest)
if err != nil {
return nil, err
}
smsVerificationCollection.EnsureHashIndex(ctx, []string{"phone_number"}, &arangoDriver.EnsureHashIndexOptions{
otpCollection.EnsureHashIndex(ctx, []string{"phone_number"}, &arangoDriver.EnsureHashIndexOptions{
Unique: true,
Sparse: true,
})