rdev/internal/domain/notify.go
jordan fa0d030def
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: improve notify domain verification reliability and add status endpoints
- Add verifyWithRetry to provisioner: 60s initial DNS propagation delay,
  5 retries with 30s backoff before marking verification as failed
- Add GetNotifyDomainStatus: polls Resend API for domain verification status,
  returns "not_configured" when Resend not set up
- Add VerifyProjectNotify: synchronous re-verification for handler use
- Add getDomainStatus to resendAPI interface + resendClient implementation
- Add NotifyDomainStatus domain struct (host, resend_domain_id, status)
- Guard NOTIFY_RESEND_DOMAIN_ID storage against empty string writes
- New handler: GET /projects/{id}/notify/status (returns verification state)
- New handler: POST /projects/{id}/notify/verify (triggers re-verification)
- Add verify-notify-domain cookbook step to persona-community,
  slackpath-1, and slackpath-4 trees (polls status for up to 6 min)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 16:25:55 -07:00

41 lines
1.2 KiB
Go

// Package domain contains core business entities.
package domain
import "time"
// NotifyCredentials holds per-project email delivery credentials.
type NotifyCredentials struct {
// ProjectID is the rdev project this credential set belongs to.
ProjectID string
// AccountID is the notify service account UUID (used for deletion).
AccountID string
// APIKey is the notify send key (notify_send_...) for sending emails.
APIKey string
// Host is the per-project sending host (e.g., "mail.{slug}.threesix.ai").
Host string
// From is the from-address for outgoing email (e.g., "noreply@mail.{slug}.threesix.ai").
From string
// ResendDomainID is the Resend domain UUID (used for deletion).
ResendDomainID string
// CreatedAt is when the credentials were provisioned.
CreatedAt time.Time
}
// NotifyDomainStatus holds the Resend verification status for a project's email domain.
type NotifyDomainStatus struct {
// Host is the per-project sending host (e.g., "mail.slug.threesix.ai").
Host string
// ResendDomainID is the Resend domain UUID.
ResendDomainID string
// Status is the Resend verification status: "verified", "pending", "failed", or "not_configured".
Status string
}