36 lines
1.4 KiB
Go
36 lines
1.4 KiB
Go
package entity
|
|
|
|
import (
|
|
"gateway/internal/model/notification/domain/enum"
|
|
|
|
"go.mongodb.org/mongo-driver/v2/bson"
|
|
)
|
|
|
|
// DLQDeliveryPayload holds non-PII metadata for admin inspection (target is not stored; use RetryDLQ with an explicit target).
|
|
type DLQDeliveryPayload struct {
|
|
Locale string `bson:"locale"`
|
|
Data map[string]any `bson:"data,omitempty"`
|
|
IdempotencyKey string `bson:"idempotency_key"`
|
|
DoNotPersistBody bool `bson:"do_not_persist_body,omitempty"`
|
|
}
|
|
|
|
// NotificationDLQ stores notifications that exceeded max retry attempts.
|
|
type NotificationDLQ struct {
|
|
ID bson.ObjectID `bson:"_id,omitempty"`
|
|
NotificationID string `bson:"notification_id"`
|
|
TenantID string `bson:"tenant_id"`
|
|
UID string `bson:"uid,omitempty"`
|
|
Channel enum.Channel `bson:"channel"`
|
|
Kind enum.NotifyKind `bson:"kind"`
|
|
TargetHash string `bson:"target_hash"`
|
|
LastError string `bson:"last_error"`
|
|
Attempts int `bson:"attempts"`
|
|
Payload *DLQDeliveryPayload `bson:"payload,omitempty"`
|
|
OccurredAt *int64 `bson:"occurred_at,omitempty"`
|
|
CreateAt *int64 `bson:"create_at,omitempty"`
|
|
}
|
|
|
|
func (d *NotificationDLQ) CollectionName() string {
|
|
return "notification_dlq"
|
|
}
|