Documentation
¶
Overview ¶
Package schema registers Hanzo Notify's domain collections with the underlying hanzoai/base app.
Nine collections cover the v1 surface:
tenants — IAM-org-slug namespace (one row per org) providers — per-tenant provider config (KMS path + status) templates — re-usable message bodies with approval lifecycle events — event catalog (routing + rate-limit policy) messages — persisted send records (audit + lookup) meter — per-send ledger for billing rollup notification_preferences — per-(user, org) channel + marketing prefs (Phase 1) notification_consent_log — append-only audit trail of preference changes notification_unsubscribe_tokens — HMAC-signed one-click unsubscribe links
Each user-data collection scopes by `tenant` (relation to `tenants`, whose id is the IAM org slug). Access rules deny anonymous read; the route layer narrows further via X-Org-Id from the platform plugin.
Index ¶
Constants ¶
const ( Tenants = "tenants" Providers = "providers" Templates = "templates" Events = "events" Messages = "messages" Meter = "meter" // Phase 1 collections from the notification-preferences paper. Preferences = "notification_preferences" ConsentLog = "notification_consent_log" UnsubscribeTokens = "notification_unsubscribe_tokens" )
Collection names. Hard-coded; this is the contract between the schema, the routes, and the worker.
const ( ConsentEventOptIn = "opt_in" ConsentEventOptOut = "opt_out" ConsentEventChannelUpdate = "channel_update" ConsentEventPrefUpdate = "pref_update" )
ConsentLog event values stored in notification_consent_log.event.
const ( MessageStatusQueued = "queued" MessageStatusSending = "sending" MessageStatusSent = "sent" MessageStatusDelivered = "delivered" MessageStatusFailed = "failed" )
Message status values stored in messages.status.
const ( ProviderStatusPendingTest = "pending_test" ProviderStatusActive = "active" ProviderStatusDisabled = "disabled" )
Provider lifecycle values stored in providers.status.
const ( TemplateStatusDraft = "draft" TemplateStatusPendingApproval = "pending_approval" TemplateStatusApproved = "approved" TemplateStatusPublished = "published" TemplateStatusArchived = "archived" )
Template lifecycle values stored in templates.status.
Variables ¶
This section is empty.
Functions ¶
func MustRegister ¶
MustRegister wires the notify schema migration into the app. Idempotent: subsequent boots find the collections already present and skip creation. Panics on registration errors so boot fails loudly.
Types ¶
This section is empty.