Forge contact module — contact channels (phone, email, website) for parties + places.
| Tier | application |
| Role | unclassified (baselined) |
| Path | crates/application/contact |
| Edition | 2024 |
| Targets | application_contact, pg_forge_contact |
| Public items | 16 across 2 modules |
| Tests | 37 |
What it is for
application-contact — contact channels for parties and places.
Capabilities
ContactModule
application-contact — contact channels for parties and places.
| Item |
|---|
pub struct ContactModule |
ContactModule :: fn new() -> Self |
ContactModule :: fn name(& self) -> & 'static str |
ContactModule :: fn version(& self) -> & 'static str |
ContactModule :: fn migrations(& self) -> Vec <MigrationSet> |
ContactModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError> |
ContactModule :: fn permission_codes(& self) -> Vec <String> |
api::contacts_admin (other)
Contact-channels admin REST router.
| Item |
|---|
pub const PERM_READ: & str |
pub const PERM_WRITE: & str |
fn to_dto(c : & Contact) -> ContactChannelDto |
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
ContactRequestError
Contact-channels admin REST router.
| Item |
|---|
pub enum ContactRequestError |
fn contact_from_create(tenant_id : Uuid, req : & CreateContactChannelRequest,) -> Result <Contact, ContactRequestError> |
fn apply_update_fields(existing : & Contact, req : & UpdateContactChannelRequest,) -> Result <(ContactType, Option <ContactPurpose>, String, Option <String>, Option <String>,), ContactRequestError,> |
ListContactsQuery
Contact-channels admin REST router.
| Item |
|---|
pub struct ListContactsQuery |
TenantQuery
Contact-channels admin REST router.
| Item |
|---|
pub struct TenantQuery |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
application_contact
apiapi::contacts_admin
flowchart TD n_application_contact["application_contact"] n_application_contact --> n_api["api"] n_api --> n_api__contacts_admin["contacts_admin"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct ContactModule | — |
ContactModule :: fn new() -> Self | — |
ContactModule :: fn name(& self) -> & 'static str | — |
ContactModule :: fn version(& self) -> & 'static str | — |
ContactModule :: fn migrations(& self) -> Vec <MigrationSet> | — |
ContactModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError> | — |
ContactModule :: fn permission_codes(& self) -> Vec <String> | — |
`api::contacts_admin`
| Item | What it is |
|---|---|
pub const PERM_READ: & str | Permission code required to read contact channels |
pub const PERM_WRITE: & str | Permission code required to create/update/delete/set-primary. |
pub struct ListContactsQuery | GET /contacts — tenant_id AND party_id are both required, no #serde(default), matching relationships_admin::ListRelationshipsQuery's contract exactly: a request for "every contact in the tenant" with no anchor party isn't served by this admin surface. |
pub struct TenantQuery | `GET\ |
pub enum ContactRequestError | Errors raised before any query runs — either the domain crate's own validation (ContactError, reused rather than re-invented per Gate 0.5) or this router's own field-length ceiling (Gate 1.5.6 item 1, which the domain crate has no opinion on). |
fn to_dto(c : & Contact) -> ContactChannelDto | Project a contact onto the wire DTO. |
fn contact_from_create(tenant_id : Uuid, req : & CreateContactChannelRequest,) -> Result <Contact, ContactRequestError> | Build a new contact from a create request |
fn apply_update_fields(existing : & Contact, req : & UpdateContactChannelRequest,) -> Result <(ContactType, Option <ContactPurpose>, String, Option <String>, Option <String>,), ContactRequestError,> | Resolve an update request against the existing row — fields absent from the request keep their existing value |
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | Contacts admin router |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
router | contacts_admin::router |
Boundary
Reaches into domain, platform.
Shares tier application with 120 other crates: application-agreements, application-ai, application-analytics, application-approvals, application-assessments, application-audit-log, application-auth, application-billing, … (120 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | application |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/application/contact |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_application["application"] --> n_domain["domain"] n_application["application"] --> n_platform["platform"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-core` | application | no | always |
| `application-rbac` | application | no | always |
| `domain-contact` | domain | no | always |
| `platform-dto` | platform | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
axum | ^0.7 | multipart | no | always |
serde | ^1 | derive | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
tracing | ^0.1 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde_json | ^1 | — | no | always |
tokio | ^1 | full | no | always |
tower | ^0.5 | — | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["application-contact"] SELF -->|runtime| n_application_core["application-core"] SELF -->|runtime| n_application_rbac["application-rbac"] SELF -->|runtime| n_domain_contact["domain-contact"] SELF -->|runtime| n_platform_dto["platform-dto"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | application_contact | `src/lib.rs` |
| test | pg_forge_contact | `tests/pg_forge_contact.rs` |
Error model
| Error type | Named by |
|---|---|
ContactRequestError | apply_update_fields, contact_from_create |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | yes |
| network I/O | yes |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CARGO_PKG_VERSION | src/lib.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 29 |
| Integration tests | 8 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 1 | 0 | 0 |
api::contacts_admin | 9 | 0 | 0 |
What the tests establish, by name:
create_list_get_update_soft_delete_round_trip—tests/pg_forge_contact.rscreate_with_is_primary_demotes_the_existing_primary_in_one_transaction—tests/pg_forge_contact.rslist_for_party_with_zero_contacts_returns_empty_not_error—tests/pg_forge_contact.rslist_is_capped_at_the_safety_limit_not_unbounded—tests/pg_forge_contact.rsmigrate_pending_creates_contacts_table—tests/pg_forge_contact.rsmigrate_pending_creates_the_primary_per_type_index—tests/pg_forge_contact.rsset_primary_demotes_the_previous_primary_atomically—tests/pg_forge_contact.rstenant_isolation_a_contact_is_never_reachable_from_another_tenant—tests/pg_forge_contact.rsa_database_error_never_reaches_the_client—src/api/contacts_admin.rsa_missing_field_error_names_the_field—src/api/contacts_admin.rsabsent_update_fields_leave_the_record_untouched—src/api/contacts_admin.rscreate_accepts_a_value_at_exactly_the_length_ceiling—src/api/contacts_admin.rscreate_can_set_primary_at_creation—src/api/contacts_admin.rscreate_defaults_unset_optionals—src/api/contacts_admin.rscreate_normalizes_an_email_value_to_lowercase_and_trims_it—src/api/contacts_admin.rscreate_rejects_a_value_over_the_length_ceiling—src/api/contacts_admin.rscreate_rejects_an_out_of_taxonomy_contact_type_without_reaching_the_database—src/api/contacts_admin.rscreate_rejects_an_out_of_taxonomy_party_type—src/api/contacts_admin.rscreate_rejects_an_out_of_taxonomy_purpose—src/api/contacts_admin.rscreate_rejects_missing_contact_type—src/api/contacts_admin.rscreate_rejects_missing_party_id—src/api/contacts_admin.rscreate_rejects_missing_party_type_without_reaching_the_database—src/api/contacts_admin.rscreate_rejects_missing_value—src/api/contacts_admin.rscreate_trims_but_does_not_lowercase_a_phone_value—src/api/contacts_admin.rscreate_without_contact_write_is_forbidden—src/api/contacts_admin.rsdto_carries_the_taxonomy_as_strings—src/api/contacts_admin.rsevery_route_refuses_a_request_with_no_tenant—src/api/contacts_admin.rslist_refuses_a_request_with_no_party_id—src/api/contacts_admin.rslist_without_contact_read_is_forbidden—src/api/contacts_admin.rsmissing_permission_context_is_never_treated_as_allowed—src/api/contacts_admin.rs- _… 7 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 9 | 16 |
Public modules with a //! block | 2 | 2 |
pie showData
title Public items with rustdoc
"Documented" : 9
"No rustdoc detected" : 7
Metrics
| Metric | Value |
|---|---|
| Rust source files | 3 |
| Source lines | 1138 |
| Code lines | 919 |
| Public API items | 16 |
| Public modules | 2 |
| Tests | 37 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 10 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"constant" : 2
"enum" : 1
"function" : 4
"method" : 6
"struct" : 3
pie showData
title Rust source composition
"Code" : 919
"Blank or comment" : 219
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.