feat: add database methods for webhookLog

This commit is contained in:
Lakhan Samani
2022-07-08 19:09:23 +05:30
parent a8064e79a1
commit ec62686fbc
20 changed files with 387 additions and 34 deletions

View File

@@ -1,17 +1,28 @@
package sql
import (
"time"
"github.com/authorizerdev/authorizer/server/db/models"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/google/uuid"
)
// AddWebhook to add webhook
func (p *provider) AddWebhook(webhook models.Webhook) (models.Webhook, error) {
if webhook.ID == "" {
webhook.ID = uuid.New().String()
}
webhook.Key = webhook.ID
webhook.CreatedAt = time.Now().Unix()
webhook.UpdatedAt = time.Now().Unix()
return webhook, nil
}
// UpdateWebhook to update webhook
func (p *provider) UpdateWebhook(webhook models.Webhook) (models.Webhook, error) {
webhook.UpdatedAt = time.Now().Unix()
return webhook, nil
}