2022-07-04 17:07:13 +00:00
|
|
|
package models
|
|
|
|
|
2022-07-08 13:39:23 +00:00
|
|
|
import "github.com/authorizerdev/authorizer/server/graph/model"
|
|
|
|
|
2022-07-04 17:07:13 +00:00
|
|
|
// Note: any change here should be reflected in providers/casandra/provider.go as it does not have model support in collection creation
|
|
|
|
|
|
|
|
// WebhookLog model for db
|
|
|
|
type WebhookLog struct {
|
2022-07-11 17:07:07 +00:00
|
|
|
Key string `json:"_key,omitempty" bson:"_key,omitempty" cql:"_key,omitempty"` // for arangodb
|
|
|
|
ID string `gorm:"primaryKey;type:char(36)" json:"_id" bson:"_id" cql:"id"`
|
|
|
|
HttpStatus int64 `json:"http_status" bson:"http_status" cql:"http_status"`
|
|
|
|
Response string `gorm:"type:text" json:"response" bson:"response" cql:"response"`
|
|
|
|
Request string `gorm:"type:text" json:"request" bson:"request" cql:"request"`
|
|
|
|
WebhookID string `gorm:"type:char(36)" json:"webhook_id" bson:"webhook_id" cql:"webhook_id"`
|
|
|
|
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at"`
|
|
|
|
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at"`
|
2022-07-04 17:07:13 +00:00
|
|
|
}
|
2022-07-08 13:39:23 +00:00
|
|
|
|
|
|
|
func (w *WebhookLog) AsAPIWebhookLog() *model.WebhookLog {
|
|
|
|
return &model.WebhookLog{
|
|
|
|
ID: w.ID,
|
|
|
|
HTTPStatus: &w.HttpStatus,
|
|
|
|
Response: &w.Response,
|
|
|
|
Request: &w.Request,
|
|
|
|
WebhookID: &w.WebhookID,
|
2022-07-09 05:51:32 +00:00
|
|
|
CreatedAt: &w.CreatedAt,
|
|
|
|
UpdatedAt: &w.UpdatedAt,
|
2022-07-08 13:39:23 +00:00
|
|
|
}
|
|
|
|
}
|