feat: add sql database methods for webhook
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package models
|
||||
|
||||
import "github.com/authorizerdev/authorizer/server/graph/model"
|
||||
|
||||
// Note: any change here should be reflected in providers/casandra/provider.go as it does not have model support in collection creation
|
||||
|
||||
// Webhook model for db
|
||||
@@ -12,3 +14,14 @@ type Webhook struct {
|
||||
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at"`
|
||||
}
|
||||
|
||||
func (w *Webhook) AsAPIWebhook() *model.Webhook {
|
||||
return &model.Webhook{
|
||||
ID: w.ID,
|
||||
EventName: &w.EventName,
|
||||
Endpoint: &w.EndPoint,
|
||||
Enabled: &w.Enabled,
|
||||
CreatedAt: &w.CreatedAt,
|
||||
UpdatedAt: &w.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
@@ -17,15 +17,13 @@ type WebhookLog struct {
|
||||
}
|
||||
|
||||
func (w *WebhookLog) AsAPIWebhookLog() *model.WebhookLog {
|
||||
createdAt := w.CreatedAt
|
||||
updatedAt := w.UpdatedAt
|
||||
return &model.WebhookLog{
|
||||
ID: w.ID,
|
||||
HTTPStatus: &w.HttpStatus,
|
||||
Response: &w.Response,
|
||||
Request: &w.Request,
|
||||
WebhookID: &w.WebhookID,
|
||||
CreatedAt: &createdAt,
|
||||
UpdatedAt: &updatedAt,
|
||||
CreatedAt: &w.CreatedAt,
|
||||
UpdatedAt: &w.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user