feat: add otp implementation for arangodb

This commit is contained in:
Lakhan Samani
2022-07-23 16:06:52 +05:30
parent 1a27d91957
commit 22ae3bca54
2 changed files with 62 additions and 1 deletions

View File

@@ -148,6 +148,20 @@ func NewProvider() (*provider, error) {
Sparse: true,
})
otpCollectionExists, err := arangodb.CollectionExists(ctx, models.Collections.OTP)
if !otpCollectionExists {
_, err = arangodb.CreateCollection(ctx, models.Collections.OTP, nil)
if err != nil {
return nil, err
}
}
otpCollection, _ := arangodb.Collection(nil, models.Collections.OTP)
otpCollection.EnsureHashIndex(ctx, []string{"email"}, &arangoDriver.EnsureHashIndexOptions{
Unique: true,
Sparse: true,
})
return &provider{
db: arangodb,
}, err