veza/veza-backend-api/internal/models/.backup-pre-uuid-migration/webhook.go
2025-12-03 20:29:37 +01:00

29 lines
1 KiB
Go

package models
import (
"time"
"github.com/lib/pq"
)
// Webhook représente une configuration de webhook
type Webhook struct {
ID uint `gorm:"primarykey" json:"id"`
UserID uint `gorm:"not null;index" json:"user_id"`
URL string `gorm:"not null" json:"url"`
Events pq.StringArray `gorm:"type:text[]" json:"events"`
Active bool `gorm:"default:true" json:"active"`
Secret string `gorm:"not null" json:"secret,omitempty"` // Ne pas exposer dans l'API
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// WebhookFailure représente un échec de livraison de webhook
type WebhookFailure struct {
ID uint `gorm:"primarykey"`
WebhookID uint `gorm:"not null;index" json:"webhook_id"`
Event string `gorm:"not null" json:"event"`
Error string `gorm:"not null" json:"error"`
Retries int `gorm:"default:0" json:"retries"`
CreatedAt time.Time `gorm:"not null" json:"created_at"`
}