fix: refs for dynamo db

This commit is contained in:
Lakhan Samani 2023-08-01 17:37:34 +05:30
parent c2defdbaac
commit 3fefcfcd9a
2 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ func (p *provider) ListVerificationRequests(ctx context.Context, pagination *mod
// DeleteVerificationRequest to delete verification request from database // DeleteVerificationRequest to delete verification request from database
func (p *provider) DeleteVerificationRequest(ctx context.Context, verificationRequest *models.VerificationRequest) error { func (p *provider) DeleteVerificationRequest(ctx context.Context, verificationRequest *models.VerificationRequest) error {
collection := p.db.Table(models.Collections.VerificationRequest) collection := p.db.Table(models.Collections.VerificationRequest)
if verificationRequest.ID != "" { if verificationRequest != nil {
err := collection.Delete("id", verificationRequest.ID).RunWithContext(ctx) err := collection.Delete("id", verificationRequest.ID).RunWithContext(ctx)
if err != nil { if err != nil {

View File

@ -114,14 +114,14 @@ func (p *provider) GetWebhookByEventName(ctx context.Context, eventName string)
// DeleteWebhook to delete webhook // DeleteWebhook to delete webhook
func (p *provider) DeleteWebhook(ctx context.Context, webhook *model.Webhook) error { func (p *provider) DeleteWebhook(ctx context.Context, webhook *model.Webhook) error {
// Also delete webhook logs for given webhook id // Also delete webhook logs for given webhook id
if webhook.ID != "" { if webhook != nil {
webhookCollection := p.db.Table(models.Collections.Webhook) webhookCollection := p.db.Table(models.Collections.Webhook)
var pagination *model.Pagination
webhookLogCollection := p.db.Table(models.Collections.WebhookLog) webhookLogCollection := p.db.Table(models.Collections.WebhookLog)
err := webhookCollection.Delete("id", webhook.ID).RunWithContext(ctx) err := webhookCollection.Delete("id", webhook.ID).RunWithContext(ctx)
if err != nil { if err != nil {
return err return err
} }
pagination := &model.Pagination{}
webhookLogs, errIs := p.ListWebhookLogs(ctx, pagination, webhook.ID) webhookLogs, errIs := p.ListWebhookLogs(ctx, pagination, webhook.ID)
for _, webhookLog := range webhookLogs.WebhookLogs { for _, webhookLog := range webhookLogs.WebhookLogs {
err = webhookLogCollection.Delete("id", webhookLog.ID).RunWithContext(ctx) err = webhookLogCollection.Delete("id", webhookLog.ID).RunWithContext(ctx)