Files
webhooker/internal/database/model_target.go
clawbot 25e27cc57f
All checks were successful
check / check (push) Successful in 1m46s
refactor: merge retry target type into http (max_retries=0 = fire-and-forget)
2026-03-01 23:51:55 -08:00

32 lines
983 B
Go

package database
// TargetType represents the type of delivery target
type TargetType string
const (
TargetTypeHTTP TargetType = "http"
TargetTypeDatabase TargetType = "database"
TargetTypeLog TargetType = "log"
)
// Target represents a delivery target for a webhook
type Target struct {
BaseModel
WebhookID string `gorm:"type:uuid;not null" json:"webhook_id"`
Name string `gorm:"not null" json:"name"`
Type TargetType `gorm:"not null" json:"type"`
Active bool `gorm:"default:true" json:"active"`
// Configuration fields (JSON stored based on type)
Config string `gorm:"type:text" json:"config"` // JSON configuration
// For HTTP targets (max_retries=0 means fire-and-forget, >0 enables retries with backoff)
MaxRetries int `json:"max_retries,omitempty"`
MaxQueueSize int `json:"max_queue_size,omitempty"`
// Relations
Webhook Webhook `json:"webhook,omitempty"`
Deliveries []Delivery `json:"deliveries,omitempty"`
}