26 lines
843 B
Go
26 lines
843 B
Go
package database
|
|
|
|
// DeliveryStatus represents the status of a delivery
|
|
type DeliveryStatus string
|
|
|
|
const (
|
|
DeliveryStatusPending DeliveryStatus = "pending"
|
|
DeliveryStatusDelivered DeliveryStatus = "delivered"
|
|
DeliveryStatusFailed DeliveryStatus = "failed"
|
|
DeliveryStatusRetrying DeliveryStatus = "retrying"
|
|
)
|
|
|
|
// Delivery represents a delivery attempt for an event to a target
|
|
type Delivery struct {
|
|
BaseModel
|
|
|
|
EventID string `gorm:"type:uuid;not null" json:"event_id"`
|
|
TargetID string `gorm:"type:uuid;not null" json:"target_id"`
|
|
Status DeliveryStatus `gorm:"not null;default:'pending'" json:"status"`
|
|
|
|
// Relations
|
|
Event Event `json:"event,omitempty"`
|
|
Target Target `json:"target,omitempty"`
|
|
DeliveryResults []DeliveryResult `json:"delivery_results,omitempty"`
|
|
}
|