CampaignFlow.MockServer.Storage.Postgres (CampaignFlow Client v2.2.0)
View SourcePostgreSQL storage adapter for the mock server.
Uses Ecto.Multi for atomic multi-table inserts when creating referrals.
Summary
Functions
Builds the API-shaped response map for a %Campaign{} struct without
going back to the database. Allows callers that already have the
struct in hand (e.g. immediately after an update) to avoid an extra
repo.get/2 round-trip.
Fetches a campaign by ID, returning the raw %Campaign{} struct (not
the API-shaped response map). Used by orchestration code that needs
to inspect schema fields like referrer_tenant_id.
Updates a campaign's status given the already-loaded struct, skipping
the initial repo.get/2. Used by cascading operations that already
have the campaign in hand.
Functions
Builds the API-shaped response map for a %Campaign{} struct without
going back to the database. Allows callers that already have the
struct in hand (e.g. immediately after an update) to avoid an extra
repo.get/2 round-trip.
Fetches a campaign by ID, returning the raw %Campaign{} struct (not
the API-shaped response map). Used by orchestration code that needs
to inspect schema fields like referrer_tenant_id.
@spec update_campaign_status_struct( struct(), String.t() ) :: {:ok, struct(), String.t()} | {:error, term()}
Updates a campaign's status given the already-loaded struct, skipping
the initial repo.get/2. Used by cascading operations that already
have the campaign in hand.