backbone-pos 0.7.0

Point of sale — cashier session, ticket + multi-tender; orchestrates billing (revenue) + payment (settlement), posts no GL directly
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::{
    pos_closing_entry_handler::create_pos_closing_entry_routes,
    pos_invoice_handler::create_pos_invoice_routes,
    pos_invoice_item_handler::create_pos_invoice_item_routes,
    pos_payment_handler::create_pos_payment_routes,
    pos_profile_handler::create_pos_profile_routes,
    pos_opening_entry_handler::create_pos_opening_entry_routes,
    pos_cash_movement_handler::create_pos_cash_movement_routes,
    pos_discount_handler::create_pos_discount_routes,
    pos_manager_pin_handler::create_pos_manager_pin_routes,
    pos_floor_plan_handler::create_pos_floor_plan_routes,
    pos_table_handler::create_pos_table_routes,
};

use crate::application::service::{
    PosClosingEntryService,
    PosInvoiceService,
    PosInvoiceItemService,
    PosPaymentService,
    PosProfileService,
    PosOpeningEntryService,
    PosCashMovementService,
    PosDiscountService,
    PosManagerPinService,
    PosFloorPlanService,
    PosTableService,
};

/// Services collection for all CRUD endpoints
pub struct HttpServices {
    pub pos_closing_entry: Arc<PosClosingEntryService>,
    pub pos_invoice: Arc<PosInvoiceService>,
    pub pos_invoice_item: Arc<PosInvoiceItemService>,
    pub pos_payment: Arc<PosPaymentService>,
    pub pos_profile: Arc<PosProfileService>,
    pub pos_opening_entry: Arc<PosOpeningEntryService>,
    pub pos_cash_movement: Arc<PosCashMovementService>,
    pub pos_discount: Arc<PosDiscountService>,
    pub pos_manager_pin: Arc<PosManagerPinService>,
    pub pos_floor_plan: Arc<PosFloorPlanService>,
    pub pos_table: Arc<PosTableService>,
}

/// 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()
        // PosClosingEntry routes (12 Backbone endpoints)
        .merge(create_pos_closing_entry_routes(services.pos_closing_entry))
        // PosInvoice routes (12 Backbone endpoints)
        .merge(create_pos_invoice_routes(services.pos_invoice))
        // PosInvoiceItem routes (12 Backbone endpoints)
        .merge(create_pos_invoice_item_routes(services.pos_invoice_item))
        // PosPayment routes (12 Backbone endpoints)
        .merge(create_pos_payment_routes(services.pos_payment))
        // PosProfile routes (12 Backbone endpoints)
        .merge(create_pos_profile_routes(services.pos_profile))
        // PosOpeningEntry routes (12 Backbone endpoints)
        .merge(create_pos_opening_entry_routes(services.pos_opening_entry))
        // PosCashMovement routes (12 Backbone endpoints)
        .merge(create_pos_cash_movement_routes(services.pos_cash_movement))
        // PosDiscount routes (12 Backbone endpoints)
        .merge(create_pos_discount_routes(services.pos_discount))
        // PosManagerPin routes (12 Backbone endpoints)
        .merge(create_pos_manager_pin_routes(services.pos_manager_pin))
        // PosFloorPlan routes (12 Backbone endpoints)
        .merge(create_pos_floor_plan_routes(services.pos_floor_plan))
        // PosTable routes (12 Backbone endpoints)
        .merge(create_pos_table_routes(services.pos_table))
}

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

    pub fn pos_closing_entry_routes(service: Arc<PosClosingEntryService>) -> Router {
        create_pos_closing_entry_routes(service)
    }

    pub fn pos_invoice_routes(service: Arc<PosInvoiceService>) -> Router {
        create_pos_invoice_routes(service)
    }

    pub fn pos_invoice_item_routes(service: Arc<PosInvoiceItemService>) -> Router {
        create_pos_invoice_item_routes(service)
    }

    pub fn pos_payment_routes(service: Arc<PosPaymentService>) -> Router {
        create_pos_payment_routes(service)
    }

    pub fn pos_profile_routes(service: Arc<PosProfileService>) -> Router {
        create_pos_profile_routes(service)
    }

    pub fn pos_opening_entry_routes(service: Arc<PosOpeningEntryService>) -> Router {
        create_pos_opening_entry_routes(service)
    }

    pub fn pos_cash_movement_routes(service: Arc<PosCashMovementService>) -> Router {
        create_pos_cash_movement_routes(service)
    }

    pub fn pos_discount_routes(service: Arc<PosDiscountService>) -> Router {
        create_pos_discount_routes(service)
    }

    pub fn pos_manager_pin_routes(service: Arc<PosManagerPinService>) -> Router {
        create_pos_manager_pin_routes(service)
    }

    pub fn pos_floor_plan_routes(service: Arc<PosFloorPlanService>) -> Router {
        create_pos_floor_plan_routes(service)
    }

    pub fn pos_table_routes(service: Arc<PosTableService>) -> Router {
        create_pos_table_routes(service)
    }

}