fix: refs for db provider and few utils

This commit is contained in:
Lakhan Samani
2023-07-31 16:42:11 +05:30
parent 146561bacb
commit 15a4be5431
82 changed files with 394 additions and 533 deletions

View File

@@ -13,7 +13,7 @@ import (
)
// AddWebhookLog to add webhook log
func (p *provider) AddWebhookLog(ctx context.Context, webhookLog models.WebhookLog) (*model.WebhookLog, error) {
func (p *provider) AddWebhookLog(ctx context.Context, webhookLog *models.WebhookLog) (*model.WebhookLog, error) {
if webhookLog.ID == "" {
webhookLog.ID = uuid.New().String()
}
@@ -34,7 +34,7 @@ func (p *provider) AddWebhookLog(ctx context.Context, webhookLog models.WebhookL
}
// ListWebhookLogs to list webhook logs
func (p *provider) ListWebhookLogs(ctx context.Context, pagination model.Pagination, webhookID string) (*model.WebhookLogs, error) {
func (p *provider) ListWebhookLogs(ctx context.Context, pagination *model.Pagination, webhookID string) (*model.WebhookLogs, error) {
var query string
var err error
@@ -66,7 +66,7 @@ func (p *provider) ListWebhookLogs(ctx context.Context, pagination model.Paginat
return nil, err
}
for queryResult.Next() {
var webhookLog models.WebhookLog
var webhookLog *models.WebhookLog
err := queryResult.Row(&webhookLog)
if err != nil {
log.Fatal(err)
@@ -79,7 +79,7 @@ func (p *provider) ListWebhookLogs(ctx context.Context, pagination model.Paginat
}
return &model.WebhookLogs{
Pagination: &paginationClone,
Pagination: paginationClone,
WebhookLogs: webhookLogs,
}, nil
}