Forge calendar module — calendar events (1:1 extension of encounters with public submission workflow).
| Tier | application |
| Role | unclassified (baselined) |
| Path | crates/application/calendar |
| Edition | 2024 |
| Targets | application_calendar, pg_forge_calendar |
| Public items | 25 across 4 modules |
| Tests | 23 |
What it is for
full model, repo/postgres layer, migrations, tests) into a real Forge module. Before this sprint migrations() returned Vec::new() and migrate_pending() was a no-op returning Ok(0) (B-009's umbrella defect, docs/bugs/B-009-forge-module-shims-not-wired.md), so calendar_events/calendar_scopes/calendar_submitter_trust were never created by anything that actually called this module's own migration path.
Capabilities
crate root
_No module-level documentation is present in the source._
| Item |
|---|
fn assert_single_tenant_mount(is_multi_tenant_host : bool) -> Result <(), & 'static str> |
CalendarModule
_No module-level documentation is present in the source._
| Item |
|---|
pub struct CalendarModule |
CalendarModule :: fn new() -> Self |
CalendarModule :: fn name(& self) -> & 'static str |
CalendarModule :: fn version(& self) -> & 'static str |
CalendarModule :: fn migrations(& self) -> Vec <MigrationSet> |
CalendarModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError> |
CalendarModule :: fn permission_codes(& self) -> Vec <String> |
api (other)
application-calendar HTTP API. Sprint 3.54.
| Item |
|---|
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
api::calendar_admin (other)
Calendar admin REST router.
| Item |
|---|
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
ModerateBody
Calendar admin REST router.
| Item |
|---|
pub struct ModerateBody |
PublicListQuery
Calendar admin REST router.
| Item |
|---|
pub struct PublicListQuery |
SubmitEventBody
Calendar admin REST router.
| Item |
|---|
pub struct SubmitEventBody |
services::calendar (other)
Calendar service — thin wrapper over content_calendar's postgres
| Item |
|---|
pub const MAX_TITLE_LEN: usize |
pub const MAX_LOCATION_LEN: usize |
pub const MAX_CATEGORY_LEN: usize |
pub const MAX_NOTES_LEN: usize |
pub const MAX_EVENT_SPAN_DAYS: i64 |
async fn submit_event(pool : & PgPool, input : SubmitEventInput,) -> Result <CalendarEvent, CalendarServiceError> |
CalendarServiceError
Calendar service — thin wrapper over content_calendar's postgres
| Item |
|---|
pub enum CalendarServiceError |
async fn approve_event(pool : & PgPool, encounter_id : Uuid, reviewer : PartyId, notes : Option <String>,) -> Result <(), CalendarServiceError> |
async fn reject_event(pool : & PgPool, encounter_id : Uuid, reviewer : PartyId, notes : Option <String>,) -> Result <(), CalendarServiceError> |
async fn list_pending(pool : & PgPool,) -> Result <Vec <CalendarEventWithEncounter>, CalendarServiceError> |
async fn list_public(pool : & PgPool, from : DateTime <Utc>, to : DateTime <Utc>,) -> Result <Vec <CalendarEventWithEncounter>, CalendarServiceError> |
SubmitEventInput
Calendar service — thin wrapper over content_calendar's postgres
| Item |
|---|
pub struct SubmitEventInput |
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_calendar
apiapi::calendar_adminservicesservices::calendar
flowchart TD n_application_calendar["application_calendar"] n_application_calendar --> n_api["api"] n_api --> n_api__calendar_admin["calendar_admin"] n_application_calendar --> n_services["services"] n_services --> n_services__calendar["calendar"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct CalendarModule | — |
CalendarModule :: fn new() -> Self | — |
CalendarModule :: fn name(& self) -> & 'static str | — |
CalendarModule :: fn version(& self) -> & 'static str | — |
CalendarModule :: fn migrations(& self) -> Vec <MigrationSet> | — |
CalendarModule :: async fn migrate_pending(& self, pool : & PgPool) -> std::result::Result <u32, MigrationError> | — |
CalendarModule :: fn permission_codes(& self) -> Vec <String> | — |
fn assert_single_tenant_mount(is_multi_tenant_host : bool) -> Result <(), & 'static str> | — |
`api`
| Item | What it is |
|---|---|
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | Admin router for the calendar moderation queue, generic over consumer state S |
`api::calendar_admin`
| Item | What it is |
|---|---|
pub struct SubmitEventBody | — |
pub struct ModerateBody | — |
pub struct PublicListQuery | — |
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | Calendar admin router |
`services::calendar`
| Item | What it is |
|---|---|
pub const MAX_TITLE_LEN: usize | Matches encounters.title VARCHAR(255). |
pub const MAX_LOCATION_LEN: usize | Matches encounters.location VARCHAR(255). |
pub const MAX_CATEGORY_LEN: usize | — |
pub const MAX_NOTES_LEN: usize | — |
pub const MAX_EVENT_SPAN_DAYS: i64 | Sanity bound on event span — rejects multi-decade schedules. |
pub enum CalendarServiceError | — |
pub struct SubmitEventInput | Input for submit_event |
async fn submit_event(pool : & PgPool, input : SubmitEventInput,) -> Result <CalendarEvent, CalendarServiceError> | — |
async fn approve_event(pool : & PgPool, encounter_id : Uuid, reviewer : PartyId, notes : Option <String>,) -> Result <(), CalendarServiceError> | Approve a pending event |
async fn reject_event(pool : & PgPool, encounter_id : Uuid, reviewer : PartyId, notes : Option <String>,) -> Result <(), CalendarServiceError> | Reject a pending event |
async fn list_pending(pool : & PgPool,) -> Result <Vec <CalendarEventWithEncounter>, CalendarServiceError> | List the moderation queue (moderation_status = 'pending' only) |
async fn list_public(pool : & PgPool, from : DateTime <Utc>, to : DateTime <Utc>,) -> Result <Vec <CalendarEventWithEncounter>, CalendarServiceError> | List approved + public events in [from, to) |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into content, identity, 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/calendar |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_application["application"] --> n_content["content"] n_application["application"] --> n_identity["identity"] n_application["application"] --> n_platform["platform"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-core` | application | no | always |
| `content-calendar` | content | no | always |
| `identity-parties` | identity | 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 |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-engine` | application | no | always |
| `application-parties` | application | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
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-calendar"] SELF -->|development| n_application_engine["application-engine"] SELF -->|development| n_application_parties["application-parties"] SELF -->|runtime| n_application_core["application-core"] SELF -->|runtime| n_content_calendar["content-calendar"] SELF -->|runtime| n_identity_parties["identity-parties"] 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_calendar | `src/lib.rs` |
| test | pg_forge_calendar | `tests/pg_forge_calendar.rs` |
Error model
| Error type | Named by |
|---|---|
CalendarServiceError | approve_event, list_pending, list_public, reject_event, submit_event |
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 | 19 |
| Integration tests | 4 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 2 | 0 | 0 |
api | 1 | 0 | 0 |
api::calendar_admin | 4 | 0 | 0 |
services::calendar | 12 | 0 | 0 |
What the tests establish, by name:
approve_moves_event_from_pending_to_public_listing—tests/pg_forge_calendar.rsmigrate_pending_creates_calendar_events_scopes_and_trust_tables—tests/pg_forge_calendar.rsreject_leaves_event_out_of_both_queues—tests/pg_forge_calendar.rssubmit_creates_pending_event_for_untrusted_submitter—tests/pg_forge_calendar.rsevery_route_is_mounted_not_404—src/api/calendar_admin.rspublic_list_requires_from_and_to—src/api/calendar_admin.rssubmit_rejects_malformed_body_before_touching_the_database—src/api/calendar_admin.rstest_moderate_code_is_distinct_from_write_and_publish—src/lib.rstest_module_migrations_non_empty—src/lib.rstest_permission_codes—src/lib.rstest_single_tenant_guard_allows_single_tenant_host—src/lib.rstest_single_tenant_guard_refuses_multi_tenant_host—src/lib.rsaccepts_a_well_formed_submission—src/services/calendar.rsaccepts_end_equal_to_start—src/services/calendar.rsaccepts_no_notes—src/services/calendar.rsaccepts_title_at_exactly_max_len—src/services/calendar.rsrejects_category_over_max_len—src/services/calendar.rsrejects_empty_title—src/services/calendar.rsrejects_end_before_start—src/services/calendar.rsrejects_location_over_max_len—src/services/calendar.rsrejects_multi_decade_span—src/services/calendar.rsrejects_notes_over_max_len—src/services/calendar.rsrejects_title_over_max_len—src/services/calendar.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 10 | 25 |
Public modules with a //! block | 3 | 4 |
pie showData
title Public items with rustdoc
"Documented" : 10
"No rustdoc detected" : 15
Metrics
| Metric | Value |
|---|---|
| Rust source files | 5 |
| Source lines | 874 |
| Code lines | 651 |
| Public API items | 25 |
| Public modules | 4 |
| Tests | 23 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 12 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"constant" : 5
"enum" : 1
"function" : 8
"method" : 6
"struct" : 5
pie showData
title Rust source composition
"Code" : 651
"Blank or comment" : 223
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.