Logistiki.Relationships.EntityAccount (logistiki v0.1.0)

Copy Markdown View Source

A many-to-many relationship between a business entity and a virtual account, with effective dating and a relationship type.

Fields

  • idinteger() — primary key (e.g. 1)
  • business_entity_idinteger() — FK to business_entities (e.g. 1)
  • virtual_account_idinteger() — FK to virtual_accounts (e.g. 10)
  • relationship_typeString.t() — one of relationship_types/0 (e.g. "owner", "beneficiary")
  • valid_fromDate.t() — when the relationship became active (e.g. ~D[2026-07-07])
  • valid_toDate.t() | nil — when it ended; nil while still active (e.g. nil or ~D[2026-12-31])

  • metadatamap() — extensible key/value store (default %{}, e.g. %{"note" => "joint account"})
  • inserted_atDateTime.t() | nil — set by Ecto (e.g. ~U[2026-07-07 12:00:00Z])

  • updated_atDateTime.t() | nil — set by Ecto

Associations

Unique constraint

The pair (business_entity_id, virtual_account_id, relationship_type) is unique — but multiple relationship types between the same entity and account are allowed (e.g. :owner and :beneficiary).

Example

%Logistiki.Relationships.EntityAccount{
  id: 1,
  business_entity_id: 1,
  virtual_account_id: 10,
  relationship_type: "owner",
  valid_from: ~D[2026-07-07],
  valid_to: nil,
  metadata: %{"note" => "primary owner"}
}

Summary

Types

t()

The EntityAccount struct type.

Functions

Returns the list of allowed relationship types as atoms.

Types

t()

@type t() :: %Logistiki.Relationships.EntityAccount{
  __meta__: term(),
  business_entity: term(),
  business_entity_id: integer() | nil,
  id: integer() | nil,
  inserted_at: DateTime.t() | nil,
  metadata: map() | nil,
  relationship_type: String.t() | nil,
  updated_at: DateTime.t() | nil,
  valid_from: Date.t() | nil,
  valid_to: Date.t() | nil,
  virtual_account: term(),
  virtual_account_id: integer() | nil
}

The EntityAccount struct type.

Represents a many-to-many link between a business entity and a virtual account with effective dating and a relationship type.

Fields

  • idinteger() | nil — primary key

  • business_entity_idinteger() | nil — FK to business_entities

  • virtual_account_idinteger() | nil — FK to virtual_accounts

  • relationship_typeString.t() | nil — e.g. "owner", "beneficiary"

  • valid_fromDate.t() | nil — when the relationship became active

  • valid_toDate.t() | nil — when it ended; nil while active

  • metadatamap() | nil — extensible metadata

  • inserted_atDateTime.t() | nil

  • updated_atDateTime.t() | nil

Example

%Logistiki.Relationships.EntityAccount{
  id: 1, business_entity_id: 1, virtual_account_id: 10,
  relationship_type: "owner", valid_from: ~D[2026-07-07], valid_to: nil
}

Functions

relationship_types()

(since 0.1.0)
@spec relationship_types() :: [atom(), ...]

Returns the list of allowed relationship types as atoms.

Returns

  • [atom()][:owner, :beneficiary, :controller, :signatory, :viewer, :trustee, :related_party, :manager, :custodian]

Examples

iex> :owner in Logistiki.Relationships.EntityAccount.relationship_types()
true