feat: add database methods for webhookLog
This commit is contained in:
@@ -6,6 +6,8 @@ type CollectionList struct {
|
||||
VerificationRequest string
|
||||
Session string
|
||||
Env string
|
||||
Webhook string
|
||||
WebhookLog string
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -17,5 +19,7 @@ var (
|
||||
VerificationRequest: Prefix + "verification_requests",
|
||||
Session: Prefix + "sessions",
|
||||
Env: Prefix + "env",
|
||||
Webhook: Prefix + "webhook",
|
||||
WebhookLog: Prefix + "webhook_log",
|
||||
}
|
||||
)
|
||||
|
@@ -1,15 +1,31 @@
|
||||
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
|
||||
|
||||
// WebhookLog model for db
|
||||
type WebhookLog struct {
|
||||
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 int32 `json:"http_status" bson:"http_status" cql:"http_status"`
|
||||
HttpStatus int64 `json:"http_status" bson:"http_status" cql:"http_status"`
|
||||
Response string `json:"response" bson:"response" cql:"response"`
|
||||
Request string `json:"request" bson:"request" cql:"request"`
|
||||
WebhookID string `gorm:"type:char(36),index:" 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"`
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user