1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! Integrations Module Routes
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! This module provides route composition with dual pattern support:
//! - Stateless routes: `create_stateless_routes()` -> `Router<()>`
//! - Stateful routes: `create_stateful_routes()` -> `Router<AppState>`
use Router;
use Arc;
// Import handlers
use crate;
// Import AppState for stateful routes
use crateAppState;
// ============================================================
// PATTERN 1: STATELESS ROUTES
// ============================================================
/// Create stateless routes for the Integrations module.
///
/// These routes don't require shared state and are simpler to use.
/// Use this when you only need standard CRUD operations.
///
/// # Example
///
/// ```ignore
/// let module = IntegrationsModule::builder().with_database(pool).build()?;
/// let routes = create_stateless_routes(&module);
/// let app = Router::new().merge(routes);
/// ```
/// Read-only routes for the Integrations module — every entity mounted READ-ONLY (the guarded base).
///
/// The generic `create_stateless_routes` exposes full mutable CRUD with no domain
/// validation; this exposes only reads, so generic mutation can't bypass a write
/// service's invariants. Extend it: `create_readonly_integrations_routes(m).merge(my_validated_writes)`.
/// Get all routes (stateless) for the Integrations module.
///
/// This is a convenience function that wraps routes with API versioning.
// ============================================================
// PATTERN 2: STATEFUL ROUTES (WITH APPSTATE)
// ============================================================
/// Create stateful routes for the Integrations module.
///
/// These routes require AppState and support custom handlers
/// that need access to services via dependency injection.
///
/// # Example
///
/// ```ignore
/// let module = IntegrationsModule::builder().with_database(pool).build()?;
/// let state = AppState::from_module(&module);
/// let routes = create_stateful_routes();
/// let app = Router::new().merge(routes).with_state(state);
/// ```
/// Create combined routes (stateless CRUD + stateful custom handlers).
///
/// This merges both stateless CRUD routes and stateful custom routes.
/// Get all routes (stateful) for the Integrations module.
///
/// This is a convenience function that wraps routes with API versioning.
// ============================================================
// CUSTOM HANDLERS
// ============================================================
// <<< CUSTOM HANDLERS START >>>
// Add custom route handlers here
// Example:
//
// use axum::extract::State;
// use axum::response::IntoResponse;
//
// pub async fn custom_handler(
// State(state): State<AppState>,
// ) -> impl IntoResponse {
// // Use state.user_service, etc.
// "Custom response"
// }
// <<< CUSTOM HANDLERS END >>>