backbone-integrations 0.6.0

Integration registry: connectors, integration accounts and an idempotent inbound event lane, with one OAuth flow (HMAC-bound state, PKCE)
Documentation
//! HTTP route configuration
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! This module provides consolidated Axum route configuration using backbone-core's
//! BackboneCrudHandler for all 12 standard Backbone CRUD endpoints per entity.

use axum::Router;
use std::sync::Arc;

use super::{
    integration_connector_handler::create_integration_connector_routes,
    integration_event_handler::create_integration_event_routes,
};

use crate::application::service::{
    IntegrationConnectorService,
    IntegrationAccountService,
    IntegrationEventService,
};

/// Services collection for all CRUD endpoints
pub struct HttpServices {
    pub integration_connector: Arc<IntegrationConnectorService>,
    pub integration_account: Arc<IntegrationAccountService>,
    pub integration_event: Arc<IntegrationEventService>,
}

/// Configure all HTTP routes for this module using Axum and BackboneCrudHandler.
///
/// Each entity gets 12 standard Backbone CRUD endpoints:
/// 1. GET /api/v1/{collection} - List with pagination
/// 2. POST /api/v1/{collection} - Create
/// 3. GET /api/v1/{collection}/:id - Get by ID
/// 4. PUT /api/v1/{collection}/:id - Full update
/// 5. PATCH /api/v1/{collection}/:id - Partial update
/// 6. DELETE /api/v1/{collection}/:id - Soft delete
/// 7. POST /api/v1/{collection}/bulk - Bulk create
/// 8. POST /api/v1/{collection}/upsert - Upsert
/// 9. GET /api/v1/{collection}/trash - List deleted
/// 10. POST /api/v1/{collection}/:id/restore - Restore
/// 11. DELETE /api/v1/{collection}/empty - Empty trash
/// 12. GET /api/v1/{collection}/:id/deleted - Get deleted by ID
pub fn configure_routes(services: HttpServices) -> Router {
    Router::new()
        // IntegrationConnector routes (12 Backbone endpoints)
        .merge(create_integration_connector_routes(services.integration_connector))
        // IntegrationEvent routes (12 Backbone endpoints)
        .merge(create_integration_event_routes(services.integration_event))
}

/// Create an individual entity's routes (for modular configuration)
pub mod individual {
    use super::*;

    pub fn integration_connector_routes(service: Arc<IntegrationConnectorService>) -> Router {
        create_integration_connector_routes(service)
    }

    pub fn integration_event_routes(service: Arc<IntegrationEventService>) -> Router {
        create_integration_event_routes(service)
    }

}