application tier

application-crm

Forge CRM pipeline module (opportunities/stages). Sprint 3.50, survey gap #3.

Forge CRM pipeline module (opportunities/stages). Sprint 3.50, survey gap #3.

Tierapplication
Roleunclassified (baselined)
Pathcrates/application/crm
Edition2024
Targetsapplication_crm
Public items22 across 4 modules
Tests4

What it is for

application-crm — Layer 3 module. Sprint 3.50 (CRM/pipeline, survey gap #3).

Capabilities

crate root

application-crm — Layer 3 module. Sprint 3.50 (CRM/pipeline, survey gap #3).

Item
fn assert_single_tenant_mount(is_multi_tenant_host : bool) -> Result <(), & 'static str>

CrmModule

application-crm — Layer 3 module. Sprint 3.50 (CRM/pipeline, survey gap #3).

Item
pub struct CrmModule
CrmModule :: fn new() -> Self
CrmModule :: fn name(& self) -> & 'static str
CrmModule :: fn version(& self) -> & 'static str
CrmModule :: fn migrations(& self) -> Vec <MigrationSet>
CrmModule :: async fn migrate_pending(& self, _pool : & PgPool) -> Result <u32, MigrationError>
CrmModule :: fn permission_codes(& self) -> Vec <String>

api (other)

application-crm HTTP API. Sprint 3.50.

Item
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,

api::crm_admin (other)

CRM admin REST router.

Item
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,

MoveStageBody

CRM admin REST router.

Item
pub struct MoveStageBody

OpportunityListQuery

CRM admin REST router.

Item
pub struct OpportunityListQuery

TenantQuery

CRM admin REST router.

Item
pub struct TenantQuery

services::crm (other)

CRM service — thin wrapper around domain_crm::CrmService.

Item
async fn ensure_default_pipeline(pool : & PgPool, tenant_id : Uuid,) -> Result <Vec <Stage>, CrmError>
async fn list_stages(pool : & PgPool, tenant_id : Uuid) -> Result <Vec <Stage>, CrmError>
async fn create_stage(pool : & PgPool, req : CreateStageRequest) -> Result <Stage, CrmError>
async fn create_opportunity(pool : & PgPool, req : CreateOpportunityRequest,) -> Result <(Opportunity, CrmEvent), CrmError>
async fn get_opportunity(pool : & PgPool, id : Uuid) -> Result <Option <Opportunity>, CrmError>
async fn opportunities_for_party(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <Vec <Opportunity>, CrmError>
async fn open_pipeline(pool : & PgPool, tenant_id : Uuid, stage_id : Option <Uuid>, owner_id : Option <Uuid>,) -> Result <Vec <Opportunity>, CrmError>
async fn move_opportunity_to_stage(pool : & PgPool, tenant_id : Uuid, opportunity_id : Uuid, target_stage_id : Uuid, probability_override : Option <i16>, lost_reason : Option <String>,) -> Result <(Opportunity, CrmEvent), CrmError>
async fn delete_opportunity(pool : & PgPool, tenant_id : Uuid, id : Uuid) -> Result <(), CrmError>

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_crm

flowchart TD
  n_application_crm["application_crm"]
  n_application_crm --> n_api["api"]
  n_api --> n_api__crm_admin["crm_admin"]
  n_application_crm --> n_services["services"]
  n_services --> n_services__crm["crm"]

Public surface

`crate root`

ItemWhat it is
pub struct CrmModule
CrmModule :: fn new() -> Self
CrmModule :: fn name(& self) -> & 'static str
CrmModule :: fn version(& self) -> & 'static str
CrmModule :: fn migrations(& self) -> Vec <MigrationSet>
CrmModule :: async fn migrate_pending(& self, _pool : & PgPool) -> Result <u32, MigrationError>
CrmModule :: fn permission_codes(& self) -> Vec <String>
fn assert_single_tenant_mount(is_multi_tenant_host : bool) -> Result <(), & 'static str>Gate 1.5 OQ4 guard: crm_opportunities.party_id cannot be tenant-checked against persons/organizations (they carry no tenant_id column yet, issue #222)

`api`

ItemWhat it is
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,Admin router for the CRM pipeline, generic over consumer state S

`api::crm_admin`

ItemWhat it is
pub struct TenantQuery
pub struct OpportunityListQuery
pub struct MoveStageBody
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,

`services::crm`

ItemWhat it is
async fn ensure_default_pipeline(pool : & PgPool, tenant_id : Uuid,) -> Result <Vec <Stage>, CrmError>
async fn list_stages(pool : & PgPool, tenant_id : Uuid) -> Result <Vec <Stage>, CrmError>
async fn create_stage(pool : & PgPool, req : CreateStageRequest) -> Result <Stage, CrmError>
async fn create_opportunity(pool : & PgPool, req : CreateOpportunityRequest,) -> Result <(Opportunity, CrmEvent), CrmError>
async fn get_opportunity(pool : & PgPool, id : Uuid) -> Result <Option <Opportunity>, CrmError>
async fn opportunities_for_party(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <Vec <Opportunity>, CrmError>
async fn open_pipeline(pool : & PgPool, tenant_id : Uuid, stage_id : Option <Uuid>, owner_id : Option <Uuid>,) -> Result <Vec <Opportunity>, CrmError>
async fn move_opportunity_to_stage(pool : & PgPool, tenant_id : Uuid, opportunity_id : Uuid, target_stage_id : Uuid, probability_override : Option <i16>, lost_reason : Option <String>,) -> Result <(Opportunity, CrmEvent), CrmError>
async fn delete_opportunity(pool : & PgPool, tenant_id : Uuid, id : Uuid) -> Result <(), CrmError>

No pub use re-exports: every item above is declared in this crate.

Boundary

Reaches into domain, foundation, 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)
Locationcrates/application/crm
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_foundation["foundation"]
  n_application["application"] --> n_platform["platform"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`application-core`applicationnoalways
`domain-crm`domainnoalways
`foundation-money`foundationnoalways
`platform-dto`platformnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
axum^0.7multipartnoalways
chrono^0.4serdenoalways
rust_decimal^1serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
tracing^0.1noalways
uuid^1v4, v7, serde, jsnoalways

Development. None.

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["application-crm"]
  SELF -->|runtime| n_application_core["application-core"]
  SELF -->|runtime| n_domain_crm["domain-crm"]
  SELF -->|runtime| n_foundation_money["foundation-money"]
  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

KindNameSource
libapplication_crm`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Oyes
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGO_PKG_VERSIONsrc/lib.rs

No workspace crate depends on this one.

Verification

KindCount
Unit tests4
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root200
api100
api::crm_admin400
services::crm900

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc222
Public modules with a //! block34
pie showData
    title Public items with rustdoc
    "Documented" : 2
    "No rustdoc detected" : 20

Metrics

MetricValue
Rust source files5
Source lines417
Code lines338
Public API items22
Public modules4
Tests4
Examples0
Cargo features0
Direct runtime dependencies14
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "function" : 12
    "method" : 6
    "struct" : 4
pie showData
    title Rust source composition
    "Code" : 338
    "Blank or comment" : 79

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.

All application · Manual