domain capa

domain-agreements

Agreement and consent tracking for terms of service, privacy policies, and GDPR compliance

Agreement and consent tracking for terms of service, privacy policies, and GDPR compliance

Tierdomain
Roleunclassified (baselined)
Pathcrates/domain/agreements
Edition2021
Targetsdomain_agreements, pg_agreements
Public items0 across 0 modules
Tests49

What it is for

# domain-agreements

Agreement and consent tracking library crates for terms of service, privacy policies, and GDPR compliance.

Layer split (sprint-3.53)

Per docs/architecture/PRIMITIVES_CRATE_TEMPLATE.md's required layer split: models.rs (domain types + Create*Request/Update*Request DTOs), repository.rs (sqlx-backed CRUD + typed helper-function wrappers), service.rs (publish/supersede/withdraw orchestration), events.rs (domain events), errors.rs (AgreementError). OQ3 (docs/userstories/sprint-3.53-forge-agreements.md) resolved that this domain crate — not the application-agreements wrapper — owns persistence.

Core Concepts

Example

use domain_agreements::{Agreement, AgreementType, AgreementVersion, Consent, ConsentMethod};
use chrono::Utc;
use uuid::Uuid;

// Create an agreement
let tos = Agreement::new("terms-of-service", "Terms of Service", AgreementType::TermsOfService)
.with_description("Legal terms governing use of our service")
.required();

// Create a version
let version = AgreementVersion::new(tos.id, "1.0", "Full terms text...")
.with_summary("Initial version")
.publish();

// Record user consent
let consent = Consent::new(Uuid::new_v4(), version.id)
.with_method(ConsentMethod::Checkbox)
.with_ip("192.168.1.1");

Capabilities

No public items.

How to use it

From this crate's own rustdoc:

use domain_agreements::{Agreement, AgreementType, AgreementVersion, Consent, ConsentMethod};
use chrono::Utc;
use uuid::Uuid;

// Create an agreement
let tos = Agreement::new("terms-of-service", "Terms of Service", AgreementType::TermsOfService)
    .with_description("Legal terms governing use of our service")
    .required();

// Create a version
let version = AgreementVersion::new(tos.id, "1.0", "Full terms text...")
    .with_summary("Initial version")
    .publish();

// Record user consent
let consent = Consent::new(Uuid::new_v4(), version.id)
    .with_method(ConsentMethod::Checkbox)
    .with_ip("192.168.1.1");

Module structure

No public modules: the crate root is its whole surface.

Public surface

No public items.

Re-exports. Exported here, defined elsewhere.

ExportDefined in
AgreementErrorerrors::AgreementError
AgreementServiceservice::AgreementService
{Agreement,AgreementType,AgreementVersion,Consent,ConsentMethod,CreateAgreementRequest,CreateAgreementVersionRequest,CreateConsentRequest,UpdateAgreementRequest,VersionStatus,MAX_CONTENT_LEN,MAX_SUMMARY_LEN,MAX_USER_AGENT_LEN,}models::{Agreement,AgreementType,AgreementVersion,Consent,ConsentMethod,CreateAgreementRequest,CreateAgreementVersionRequest,CreateConsentRequest,UpdateAgreementRequest,VersionStatus,MAX_CONTENT_LEN,MAX_SUMMARY_LEN,MAX_USER_AGENT_LEN,}
{AgreementCreated,AgreementVersionPublished,ConsentRecorded,ConsentWithdrawn}events::{AgreementCreated,AgreementVersionPublished,ConsentRecorded,ConsentWithdrawn}
{AgreementRepository,CurrentVersion,PendingAgreement}repository::{AgreementRepository,CurrentVersion,PendingAgreement}
{HasId,SoftDeletable,Timestamped}foundation_basemodels::{HasId,SoftDeletable,Timestamped}

Boundary

Reaches into foundation.

Shares tier domain with 41 other crates: domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, domain-conversation-engine, … (41 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)domain
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/domain/agreements
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_domain["domain"] --> n_foundation["foundation"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-basemodels`foundationnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
tokio^1fullnoalways
tracing^0.1noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio-test^0.4noalways

Build. None.

Depended on by. 1 workspace crate.

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

flowchart LR
  n_application_agreements["application-agreements"] -->|uses| SELF
  SELF["domain-agreements"]
  SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"]
  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
libdomain_agreements`src/lib.rs`
testpg_agreements`tests/pg_agreements.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 surfacenone detected
async runtimeyes
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

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

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-agreements.

Verification

KindCount
Unit tests37
Integration tests12
Examples0
Doctests1

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc00
Public modules with a //! block00

Metrics

MetricValue
Rust source files6
Source lines2048
Code lines1421
Public API items0
Public modules0
Tests49
Examples0
Cargo features0
Direct runtime dependencies9
Workspace reverse dependencies1
pie showData
    title Rust source composition
    "Code" : 1421
    "Blank or comment" : 627

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.

Todas las domain · Manual