feat: init email template schema for all providers

This commit is contained in:
Lakhan Samani
2022-07-15 10:23:45 +05:30
parent 14c74f6566
commit 283e570ebb
4 changed files with 35 additions and 1 deletions

View File

@@ -101,6 +101,15 @@ func NewProvider() (*provider, error) {
},
}, options.CreateIndexes())
mongodb.CreateCollection(ctx, models.Collections.EmailTemplate, options.CreateCollection())
emailTemplateCollection := mongodb.Collection(models.Collections.EmailTemplate, options.Collection())
emailTemplateCollection.Indexes().CreateMany(ctx, []mongo.IndexModel{
{
Keys: bson.M{"event_name": 1},
Options: options.Index().SetUnique(true).SetSparse(true),
},
}, options.CreateIndexes())
return &provider{
db: mongodb,
}, nil