application capa

application-notifications

Forge notifications module — thin wrapper around domain-notifications. Sprint 57 prerequisite for application-tickets.

Forge notifications module — thin wrapper around domain-notifications. Sprint 57 prerequisite for application-tickets.

Tierapplication
Roleunclassified (baselined)
Pathcrates/application/notifications
Edition2024
Targetsapplication_notifications, pg_forge_notifications
Public items23 across 4 modules
Tests4

What it is for

application-notifications — Layer 3 module for notifications.

Thin wrapper around domain-notifications. Extracted from rust-cms-engine in sprint 57 as a prerequisite for application-tickets (tickets fire notifications on state transitions).

B-009: before this, migrations() returned Vec::new() and migrate_pending returned Ok(0) while ignoring the pool, so notifications/notification_templates/notification_preferences/ delivery_attempts (plus the unread-count/channel-enabled helper functions and RLS policies, crates/domain/notifications/migrations/001_notifications_init.sql) were never created by anything that actually called this module's own migration path. All four tables are self-contained (FKs stay inside this library crate's own schema — recipient_party_id/party_id are bare UUIDs, not constraints), so migrate_pending needs no cross-module bootstrap. Mirrors application-encounters's and application-calendar's pattern exactly.

Capabilities

NotificationsModule

application-notifications — Layer 3 module for notifications.

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

api (other)

HTTP API routers for application-notifications.

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

api::notifications_admin (other)

Notifications admin REST router.

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

ListQuery

Notifications admin REST router.

Item
pub struct ListQuery

MarkAllReadInput

Notifications admin REST router.

Item
pub struct MarkAllReadInput

PreferencesQuery

Notifications admin REST router.

Item
pub struct PreferencesQuery

UnreadCountQuery

Notifications admin REST router.

Item
pub struct UnreadCountQuery

UpdatePreferenceInput

Notifications admin REST router.

Item
pub struct UpdatePreferenceInput

services::notifications (other)

Notifications service — thin wrapper around

Item
async fn list(pool : & PgPool, tenant_id : Uuid, party_id : Uuid, limit : i64, offset : i64,) -> Result <Vec <Notification>, NotificationError>
async fn list_unread(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <Vec <Notification>, NotificationError>
async fn count_unread(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <i64, NotificationError>
async fn get(pool : & PgPool, id : Uuid) -> Result <Option <Notification>, NotificationError>
async fn mark_read(pool : & PgPool, id : Uuid) -> Result <bool, NotificationError>
async fn mark_all_read(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <i64, NotificationError>
async fn get_preferences(pool : & PgPool, party_id : Uuid, tenant_id : Uuid,) -> Result <Vec <NotificationPreference>, NotificationError>
async fn update_preferences(pool : & PgPool, party_id : Uuid, tenant_id : Uuid, channel : NotificationChannel, event_type : Option <String>, enabled : bool,) -> Result <NotificationPreference, NotificationError>
async fn create_for_party(pool : & PgPool, tenant_id : Uuid, recipient_party_id : Uuid, event_type : impl Into <String>, title : impl Into <String>, body : impl Into <String>, entity_type : Option <& str>, entity_id : Option <Uuid>, idempotency_key : Option <String>,) -> Result <Notification, NotificationError>

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_notifications

flowchart TD
  n_application_notifications["application_notifications"]
  n_application_notifications --> n_api["api"]
  n_api --> n_api__notifications_admin["notifications_admin"]
  n_application_notifications --> n_services["services"]
  n_services --> n_services__notifications["notifications"]

Public surface

`crate root`

ItemWhat it is
pub struct NotificationsModule
NotificationsModule :: fn new() -> Self
NotificationsModule :: fn name(& self) -> & 'static str
NotificationsModule :: fn version(& self) -> & 'static str
NotificationsModule :: fn migrations(& self) -> Vec <MigrationSet>
NotificationsModule :: async fn migrate_pending(& self, pool : & PgPool) -> Result <u32, MigrationError>
NotificationsModule :: fn permission_codes(& self) -> Vec <String>sprint-3.7 S1 T3 — the permission vocabulary this module's admin router expects a host to enforce

`api`

ItemWhat it is
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,Admin router composing all notifications admin sub-routers.

`api::notifications_admin`

ItemWhat it is
pub struct ListQuery
pub struct UnreadCountQuery
pub struct MarkAllReadInput
pub struct PreferencesQuery
pub struct UpdatePreferenceInput
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>,

`services::notifications`

ItemWhat it is
async fn list(pool : & PgPool, tenant_id : Uuid, party_id : Uuid, limit : i64, offset : i64,) -> Result <Vec <Notification>, NotificationError>
async fn list_unread(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <Vec <Notification>, NotificationError>
async fn count_unread(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <i64, NotificationError>
async fn get(pool : & PgPool, id : Uuid) -> Result <Option <Notification>, NotificationError>
async fn mark_read(pool : & PgPool, id : Uuid) -> Result <bool, NotificationError>
async fn mark_all_read(pool : & PgPool, tenant_id : Uuid, party_id : Uuid,) -> Result <i64, NotificationError>
async fn get_preferences(pool : & PgPool, party_id : Uuid, tenant_id : Uuid,) -> Result <Vec <NotificationPreference>, NotificationError>
async fn update_preferences(pool : & PgPool, party_id : Uuid, tenant_id : Uuid, channel : NotificationChannel, event_type : Option <String>, enabled : bool,) -> Result <NotificationPreference, NotificationError>
async fn create_for_party(pool : & PgPool, tenant_id : Uuid, recipient_party_id : Uuid, event_type : impl Into <String>, title : impl Into <String>, body : impl Into <String>, entity_type : Option <& str>, entity_id : Option <Uuid>, idempotency_key : Option <String>,) -> Result <Notification, NotificationError>Create an in-app notification for a specific party

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

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)
Locationcrates/application/notifications
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.

CrateTierOptionalOnly on
`application-core`applicationnoalways
`domain-notifications`domainnoalways
`platform-dto`platformnoalways

Runtime, from outside the workspace.

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

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1fullnoalways

Build. None.

Depended on by. 2 workspace crates.

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

flowchart LR
  n_application_dlp["application-dlp"] -->|uses| SELF
  n_application_tickets["application-tickets"] -->|uses| SELF
  SELF["application-notifications"]
  SELF -->|runtime| n_application_core["application-core"]
  SELF -->|runtime| n_domain_notifications["domain-notifications"]
  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_notifications`src/lib.rs`
testpg_forge_notifications`tests/pg_forge_notifications.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

2 workspace crates depend on this one: application-dlp, application-tickets.

Verification

KindCount
Unit tests3
Integration tests1
Examples0
Doctests0

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

ModuleTestsExamplesConsumers
crate root100
api102
api::notifications_admin601
services::notifications905

What the tests establish, by name:

Documentation coverage

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

Metrics

MetricValue
Rust source files5
Source lines512
Code lines375
Public API items23
Public modules4
Tests4
Examples0
Cargo features0
Direct runtime dependencies10
Workspace reverse dependencies2
pie showData
    title Public API by kind
    "function" : 11
    "method" : 6
    "struct" : 6
pie showData
    title Rust source composition
    "Code" : 375
    "Blank or comment" : 137

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 application · Manual