backbone-bucket 0.3.0

Bucket Bounded Context: File Storage Module for Backbone Framework
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::{
    bucket_handler::create_bucket_routes,
    content_hash_handler::create_content_hash_routes,
    conversion_job_handler::create_conversion_job_routes,
    file_comment_handler::create_file_comment_routes,
    file_lock_handler::create_file_lock_routes,
    file_share_handler::create_file_share_routes,
    processing_job_handler::create_processing_job_routes,
    stored_file_handler::create_stored_file_routes,
    upload_session_handler::create_upload_session_routes,
    user_quota_handler::create_user_quota_routes,
};

use crate::application::service::{
    AccessLogService,
    BucketService,
    ContentHashService,
    ConversionJobService,
    FileCommentService,
    FileLockService,
    FileShareService,
    FileVersionService,
    ProcessingJobService,
    StoredFileService,
    ThumbnailService,
    UploadSessionService,
    UserQuotaService,
};

/// Services collection for all CRUD endpoints
pub struct HttpServices {
    pub access_log: Arc<AccessLogService>,
    pub bucket: Arc<BucketService>,
    pub content_hash: Arc<ContentHashService>,
    pub conversion_job: Arc<ConversionJobService>,
    pub file_comment: Arc<FileCommentService>,
    pub file_lock: Arc<FileLockService>,
    pub file_share: Arc<FileShareService>,
    pub file_version: Arc<FileVersionService>,
    pub processing_job: Arc<ProcessingJobService>,
    pub stored_file: Arc<StoredFileService>,
    pub thumbnail: Arc<ThumbnailService>,
    pub upload_session: Arc<UploadSessionService>,
    pub user_quota: Arc<UserQuotaService>,
}

/// 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()
        // Bucket routes (12 Backbone endpoints)
        .merge(create_bucket_routes(services.bucket))
        // ContentHash routes (12 Backbone endpoints)
        .merge(create_content_hash_routes(services.content_hash))
        // ConversionJob routes (12 Backbone endpoints)
        .merge(create_conversion_job_routes(services.conversion_job))
        // FileComment routes (12 Backbone endpoints)
        .merge(create_file_comment_routes(services.file_comment))
        // FileLock routes (12 Backbone endpoints)
        .merge(create_file_lock_routes(services.file_lock))
        // FileShare routes (12 Backbone endpoints)
        .merge(create_file_share_routes(services.file_share))
        // ProcessingJob routes (12 Backbone endpoints)
        .merge(create_processing_job_routes(services.processing_job))
        // StoredFile routes (12 Backbone endpoints)
        .merge(create_stored_file_routes(services.stored_file))
        // UploadSession routes (12 Backbone endpoints)
        .merge(create_upload_session_routes(services.upload_session))
        // UserQuota routes (12 Backbone endpoints)
        .merge(create_user_quota_routes(services.user_quota))
}

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

    pub fn bucket_routes(service: Arc<BucketService>) -> Router {
        create_bucket_routes(service)
    }

    pub fn content_hash_routes(service: Arc<ContentHashService>) -> Router {
        create_content_hash_routes(service)
    }

    pub fn conversion_job_routes(service: Arc<ConversionJobService>) -> Router {
        create_conversion_job_routes(service)
    }

    pub fn file_comment_routes(service: Arc<FileCommentService>) -> Router {
        create_file_comment_routes(service)
    }

    pub fn file_lock_routes(service: Arc<FileLockService>) -> Router {
        create_file_lock_routes(service)
    }

    pub fn file_share_routes(service: Arc<FileShareService>) -> Router {
        create_file_share_routes(service)
    }

    pub fn processing_job_routes(service: Arc<ProcessingJobService>) -> Router {
        create_processing_job_routes(service)
    }

    pub fn stored_file_routes(service: Arc<StoredFileService>) -> Router {
        create_stored_file_routes(service)
    }

    pub fn upload_session_routes(service: Arc<UploadSessionService>) -> Router {
        create_upload_session_routes(service)
    }

    pub fn user_quota_routes(service: Arc<UserQuotaService>) -> Router {
        create_user_quota_routes(service)
    }

}