feat: add database methods for webhookLog
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
package arangodb
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user