2022-07-06 05:08:21 +00:00
|
|
|
package provider_template
|
|
|
|
|
|
|
|
import (
|
2022-07-10 16:19:33 +00:00
|
|
|
"context"
|
2022-07-08 13:39:23 +00:00
|
|
|
"time"
|
|
|
|
|
2022-07-06 05:08:21 +00:00
|
|
|
"github.com/authorizerdev/authorizer/server/db/models"
|
|
|
|
"github.com/authorizerdev/authorizer/server/graph/model"
|
2022-07-08 13:39:23 +00:00
|
|
|
"github.com/google/uuid"
|
2022-07-06 05:08:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// AddWebhookLog to add webhook log
|
2022-07-10 16:19:33 +00:00
|
|
|
func (p *provider) AddWebhookLog(ctx context.Context, webhookLog models.WebhookLog) (*model.WebhookLog, error) {
|
2022-07-08 13:39:23 +00:00
|
|
|
if webhookLog.ID == "" {
|
|
|
|
webhookLog.ID = uuid.New().String()
|
|
|
|
}
|
|
|
|
|
|
|
|
webhookLog.Key = webhookLog.ID
|
|
|
|
webhookLog.CreatedAt = time.Now().Unix()
|
|
|
|
webhookLog.UpdatedAt = time.Now().Unix()
|
2022-07-10 16:19:33 +00:00
|
|
|
return webhookLog.AsAPIWebhookLog(), nil
|
2022-07-06 05:08:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListWebhookLogs to list webhook logs
|
2022-07-10 16:19:33 +00:00
|
|
|
func (p *provider) ListWebhookLogs(ctx context.Context, pagination model.Pagination, webhookID string) (*model.WebhookLogs, error) {
|
2022-07-06 05:08:21 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|