CampaignFlow.MockServer.Storage behaviour (CampaignFlow Client v2.2.0)

View Source

Storage behaviour for mock server persistence.

The mock server uses PostgreSQL for storage via the host application's Ecto Repo.

Configuration

Configure the mock server with your repo:

config :campaign_flow, :mock_server,
  enabled: true,
  repo: MyApp.Repo

Summary

Functions

Returns the configured Ecto repo, or nil if not configured.

Callbacks

clear_all()

@callback clear_all() :: :ok

create_finance_application(campaign_id)

@callback create_finance_application(campaign_id :: integer()) ::
  {:ok, struct()} | :not_found | {:error, term()}

create_referral(params)

@callback create_referral(params :: map()) :: {:ok, map()} | {:error, term()}

get_campaign(id)

@callback get_campaign(id :: integer()) :: {:ok, map()} | :not_found

get_finance_application(id)

@callback get_finance_application(id :: integer()) :: {:ok, struct()} | :not_found

get_referral(id)

@callback get_referral(id :: integer()) :: {:ok, map()} | :not_found

list_referrals()

@callback list_referrals() :: [map()]

update_campaign_status(id, new_status)

@callback update_campaign_status(id :: integer(), new_status :: String.t()) ::
  {:ok, struct(), String.t()} | :not_found | {:error, term()}

update_finance_application_status(id, new_status)

@callback update_finance_application_status(id :: integer(), new_status :: String.t()) ::
  {:ok, struct(), String.t()} | :not_found | {:error, term()}

Functions

repo()

@spec repo() :: module() | nil

Returns the configured Ecto repo, or nil if not configured.