pjson_rs/application/
mod.rs

1//! Application layer - Use cases and orchestration
2//!
3//! Implements CQRS pattern with separate command and query handlers.
4//! Orchestrates domain logic and infrastructure concerns.
5
6pub mod commands;
7pub mod dto;
8pub mod handlers;
9pub mod queries;
10pub mod services;
11pub mod shared;
12
13pub use commands::*;
14pub use handlers::{CommandHandler, QueryHandler};
15pub use queries::*;
16pub use shared::AdjustmentUrgency;
17
18/// Application Result type
19pub type ApplicationResult<T> = Result<T, ApplicationError>;
20
21/// Application-specific errors
22#[derive(Debug, thiserror::Error)]
23pub enum ApplicationError {
24    #[error("Domain error: {0}")]
25    Domain(#[from] crate::domain::DomainError),
26
27    #[error("Validation error: {0}")]
28    Validation(String),
29
30    #[error("Authorization error: {0}")]
31    Authorization(String),
32
33    #[error("Concurrency error: {0}")]
34    Concurrency(String),
35
36    #[error("Not found: {0}")]
37    NotFound(String),
38
39    #[error("Conflict: {0}")]
40    Conflict(String),
41
42    #[error("Application logic error: {0}")]
43    Logic(String),
44}