Files
webhooker/internal/database/model_target.go
T
clawbot 48176e6425
check / check (push) Successful in 3m21s
Remove an http target's max_queue_size (closes #477)
Nothing in delivery ever read it, so setting it bounded nothing. The
field, the "Max Queue Size" line in the target list, its README row and
the tests that set or checked it are gone. An existing database keeps
its old column, which is no longer read.

Model: opus-5-5
2026-10-02 23:23:58 +00:00

41 lines
1.4 KiB
Go

package database
// TargetType represents the type of delivery target
type TargetType string
// Target type values.
const (
TargetTypeHTTP TargetType = "http"
TargetTypeDatabase TargetType = "database"
TargetTypeLog TargetType = "log"
TargetTypeSlack TargetType = "slack"
)
// Target represents a delivery target for a webhook
type Target struct {
BaseModel
WebhookID string `gorm:"type:uuid;not null" json:"webhookId"`
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).
//
// json:"-" because the blob holds the target's credential — a
// Slack incoming-webhook URL, or an http destination whose path
// segments are the secret. delivery.TargetView is the masking
// barrier for the HTML path; this tag is the barrier for any
// handler that marshals the model itself.
Config string `gorm:"type:text" json:"-"` // JSON configuration
// For HTTP targets (max_retries=0 means fire-and-forget,
// >0 enables retries with backoff)
MaxRetries int `json:"maxRetries,omitempty"`
// Relations. No model marshals the record it belongs to:
// Webhook.Targets leads back here, and the JSON could loop.
Webhook Webhook `json:"-"`
Deliveries []Delivery `json:"deliveries,omitempty"`
}