ores.refdata.counterparty_contact_information

Table of Contents

Contact details for counterparties organised by purpose (Legal, Operations, Settlement, Billing). Each counterparty can have one contact record per type.

Flags

Columns

id

UUID uniquely identifying this contact information record.

Surrogate key for the counterparty contact information record.

counterparty_id

The counterparty this contact information belongs to.

References the parent counterparty record.

uuid_gen()

contact_type

The type or purpose of this contact.

References the contact_type lookup table (e.g. Legal, Operations).

// no_generator_suffix: validated enum, a "-<idx>" suffix would be invalid.
// Rotate so a batch of several contact rows for one counterparty gets
// distinct types (max one contact row per type per counterparty).
[idx]{
    static constexpr const char* types[] = {
        "Legal", "Operations", "Settlement", "Billing"};
    return std::string(types[idx % 4]);
}()

street_line_1

First line of the street address.

Primary address line.

std::string("456 Test Avenue")

street_line_2

Second line of the street address.

Additional address line (suite, floor, etc.).

std::string("Floor 10")

city

City name.

City or town of the address.

std::string("New York")

state

State or province.

State, province, or region.

std::string("NY")

country_code

ISO 3166-1 alpha-2 country code.

References the countries table (soft FK).

// Left blank: validated against the tenant-scoped countries table, which
// isolated test tenants don't seed; empty skips validation.
std::string("")
-- Paste block: doesn't fit soft_fk_validations (joins on id, not
-- an alpha-2 code column) or the Validations table
-- (ores_refdata_validate_country_fn only checks non-null/empty,
-- not existence).
-- Validate country_code (nullable, inline check against countries table)
if NEW.country_code is not null and NEW.country_code != '' then
    if not exists (
        select 1 from ores_refdata_countries_tbl
        where tenant_id = NEW.tenant_id
          and alpha2_code = NEW.country_code
          and valid_to = ores_utility_infinity_timestamp_fn()
    ) then
        raise exception 'Invalid country_code: %. Must be a valid ISO 3166-1 alpha-2 code.',
            NEW.country_code
            using errcode = '23503';
    end if;
end if;

postal_code

Postal or ZIP code.

Postal code for the address.

std::string("10001")

phone

Phone number.

Contact phone number in international format.

std::string("+1 212 555 0100")

email

Email address.

Contact email address.

std::string("info@example.com")

web_page

Web page URL.

Contact web page address.

std::string("https://example.com")

SQL

Flags

Foreign keys

counterparty_id

Insert trigger

Validations

column validation_function
contact_type ores_refdata_validate_contact_type_fn

C++

Flags

Repository

Domain includes

#include <chrono>
#include <string>
#include <boost/uuid/uuid.hpp>

Entity includes

#include <string>
#include "sqlgen/Timestamp.hpp"
#include "sqlgen/PrimaryKey.hpp"

Conventions

Table display

column header
counterparty_id Counterparty
contact_type Type
city City
country_code Country
phone Phone
email Email
modified_by Modified By
version Version

Custom repository methods

Qt

Note: counterparty_id is deliberately not exposed as a Detail field – like Book's parent_portfolio_id, it's always known from the owning context (the counterparty's own Contact Information tab) and set programmatically before the dialog is shown, never user-chosen.

Detail fields

field label widget type is_key is_required placeholder flag_source combo_allow_blank combo_fetch combo_domain_type combo_fetch_include combo_fetch_fn combo_watcher_name combo_code_field combo_tooltip_field combo_sort_field combo_label combo_setter_pascal badge_key
id Id idEdit line_edit true true Contact id                          
contact_type Type contactTypeCombo dynamic_combo false true         refdata::domain::contact_type ores.qt/LookupFetcher.hpp fetch_contact_types contactTypeWatcher code description display_order contact types ContactTypeCombo  
street_line_1 Street Line 1 streetLine1Edit line_edit false false Enter street line 1                          
street_line_2 Street Line 2 streetLine2Edit line_edit false false Enter street line 2                          
city City cityEdit line_edit false false Enter city                          
state State stateEdit line_edit false false Enter state                          
country_code Country Code countryCodeCombo flagged_combo false false   country true fetch_country_codes   ores.qt/LookupFetcher.hpp                
postal_code Postal Code postalCodeEdit line_edit false false Enter postal code                          
phone Phone phoneEdit line_edit false false Enter phone                          
email Email emailEdit line_edit false false Enter email                          
web_page Web Page webPageEdit line_edit false false Enter web page                          

Columns (Qt model)

enum_name field header type width
ContactType contact_type Type string 120
StreetLine1 street_line_1 Street string 180
City city City string 120
CountryCode country_code Country string 100
Phone phone Phone string 140
Email email Email string 180
Version version Version int 80
ModifiedBy modified_by Modified By string 120
RecordedAt recorded_at Recorded At timestamp 150

Icon columns (Qt model)

column accessor field1 field2
CountryCode country_flag_icon country_code  

See also

Emacs 29.3 (Org mode 9.6.15)