backbone-inventory 0.10.2

Inventory: stock ledger of record (SLE) + moving-average valuation; emits COGS/asset AccountingPost (Delivery/Receipt -> GL)
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::{
    picking_batch_handler::create_picking_batch_read_routes,
    delivery_note_handler::create_delivery_note_read_routes,
    delivery_note_item_handler::create_delivery_note_item_read_routes,
    inventory_company_setting_handler::create_inventory_company_setting_routes,
    landed_cost_handler::create_landed_cost_read_routes,
    landed_cost_line_handler::create_landed_cost_line_read_routes,
    landed_cost_adjustment_line_handler::create_landed_cost_adjustment_line_read_routes,
    location_handler::create_location_routes,
    stock_move_handler::create_stock_move_read_routes,
    stock_move_line_handler::create_stock_move_line_read_routes,
    operation_type_handler::create_operation_type_routes,
    transfer_handler::create_transfer_read_routes,
    route_handler::create_route_routes,
    route_rule_handler::create_route_rule_routes,
    reordering_rule_handler::create_reordering_rule_routes,
    purchase_receipt_handler::create_purchase_receipt_read_routes,
    purchase_receipt_item_handler::create_purchase_receipt_item_read_routes,
    quant_handler::create_quant_read_routes,
    scrap_handler::create_scrap_read_routes,
    scrap_reason_tag_handler::create_scrap_reason_tag_routes,
    stock_entry_handler::create_stock_entry_read_routes,
    stock_entry_item_handler::create_stock_entry_item_read_routes,
    stock_ledger_entry_handler::create_stock_ledger_entry_read_routes,
    bin_handler::create_bin_read_routes,
    stock_reconciliation_handler::create_stock_reconciliation_read_routes,
    stock_reconciliation_item_handler::create_stock_reconciliation_item_read_routes,
    package_type_handler::create_package_type_routes,
    storage_category_handler::create_storage_category_routes,
    storage_category_capacity_handler::create_storage_category_capacity_routes,
    putaway_rule_handler::create_putaway_rule_routes,
    lot_handler::create_lot_routes,
    package_handler::create_package_routes,
    warehouse_handler::create_warehouse_routes,
    stock_item_handler::create_stock_item_routes,
};

use crate::application::service::{
    PickingBatchService,
    DeliveryNoteService,
    DeliveryNoteItemService,
    InventoryCompanySettingService,
    LandedCostService,
    LandedCostLineService,
    LandedCostAdjustmentLineService,
    LocationService,
    StockMoveService,
    StockMoveLineService,
    OperationTypeService,
    TransferService,
    RouteService,
    RouteRuleService,
    ReorderingRuleService,
    PurchaseReceiptService,
    PurchaseReceiptItemService,
    QuantService,
    ScrapService,
    ScrapReasonTagService,
    StockEntryService,
    StockEntryItemService,
    StockLedgerEntryService,
    BinService,
    StockReconciliationService,
    StockReconciliationItemService,
    PackageTypeService,
    StorageCategoryService,
    StorageCategoryCapacityService,
    PutawayRuleService,
    LotService,
    PackageService,
    WarehouseService,
    StockItemService,
};

/// Services collection for all CRUD endpoints
pub struct HttpServices {
    pub picking_batch: Arc<PickingBatchService>,
    pub delivery_note: Arc<DeliveryNoteService>,
    pub delivery_note_item: Arc<DeliveryNoteItemService>,
    pub inventory_company_setting: Arc<InventoryCompanySettingService>,
    pub landed_cost: Arc<LandedCostService>,
    pub landed_cost_line: Arc<LandedCostLineService>,
    pub landed_cost_adjustment_line: Arc<LandedCostAdjustmentLineService>,
    pub location: Arc<LocationService>,
    pub stock_move: Arc<StockMoveService>,
    pub stock_move_line: Arc<StockMoveLineService>,
    pub operation_type: Arc<OperationTypeService>,
    pub transfer: Arc<TransferService>,
    pub route: Arc<RouteService>,
    pub route_rule: Arc<RouteRuleService>,
    pub reordering_rule: Arc<ReorderingRuleService>,
    pub purchase_receipt: Arc<PurchaseReceiptService>,
    pub purchase_receipt_item: Arc<PurchaseReceiptItemService>,
    pub quant: Arc<QuantService>,
    pub scrap: Arc<ScrapService>,
    pub scrap_reason_tag: Arc<ScrapReasonTagService>,
    pub stock_entry: Arc<StockEntryService>,
    pub stock_entry_item: Arc<StockEntryItemService>,
    pub stock_ledger_entry: Arc<StockLedgerEntryService>,
    pub bin: Arc<BinService>,
    pub stock_reconciliation: Arc<StockReconciliationService>,
    pub stock_reconciliation_item: Arc<StockReconciliationItemService>,
    pub package_type: Arc<PackageTypeService>,
    pub storage_category: Arc<StorageCategoryService>,
    pub storage_category_capacity: Arc<StorageCategoryCapacityService>,
    pub putaway_rule: Arc<PutawayRuleService>,
    pub lot: Arc<LotService>,
    pub package: Arc<PackageService>,
    pub warehouse: Arc<WarehouseService>,
    pub stock_item: Arc<StockItemService>,
}

/// 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()
        // PickingBatch routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_picking_batch_read_routes(services.picking_batch))
        // DeliveryNote routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_delivery_note_read_routes(services.delivery_note))
        // DeliveryNoteItem routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_delivery_note_item_read_routes(services.delivery_note_item))
        // InventoryCompanySetting routes (12 Backbone endpoints)
        .merge(create_inventory_company_setting_routes(services.inventory_company_setting))
        // LandedCost routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_landed_cost_read_routes(services.landed_cost))
        // LandedCostLine routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_landed_cost_line_read_routes(services.landed_cost_line))
        // LandedCostAdjustmentLine routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_landed_cost_adjustment_line_read_routes(services.landed_cost_adjustment_line))
        // Location routes (12 Backbone endpoints)
        .merge(create_location_routes(services.location))
        // StockMove routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_stock_move_read_routes(services.stock_move))
        // StockMoveLine routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_stock_move_line_read_routes(services.stock_move_line))
        // OperationType routes (12 Backbone endpoints)
        .merge(create_operation_type_routes(services.operation_type))
        // Transfer routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_transfer_read_routes(services.transfer))
        // Route routes (12 Backbone endpoints)
        .merge(create_route_routes(services.route))
        // RouteRule routes (12 Backbone endpoints)
        .merge(create_route_rule_routes(services.route_rule))
        // ReorderingRule routes (12 Backbone endpoints)
        .merge(create_reordering_rule_routes(services.reordering_rule))
        // PurchaseReceipt routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_purchase_receipt_read_routes(services.purchase_receipt))
        // PurchaseReceiptItem routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_purchase_receipt_item_read_routes(services.purchase_receipt_item))
        // Quant routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_quant_read_routes(services.quant))
        // Scrap routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_scrap_read_routes(services.scrap))
        // ScrapReasonTag routes (12 Backbone endpoints)
        .merge(create_scrap_reason_tag_routes(services.scrap_reason_tag))
        // StockEntry routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_stock_entry_read_routes(services.stock_entry))
        // StockEntryItem routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_stock_entry_item_read_routes(services.stock_entry_item))
        // StockLedgerEntry routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_stock_ledger_entry_read_routes(services.stock_ledger_entry))
        // Bin routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_bin_read_routes(services.bin))
        // StockReconciliation routes (READ-ONLY mount — hand_set lifecycle; the state field moves only through the module's validated verbs)
        .merge(create_stock_reconciliation_read_routes(services.stock_reconciliation))
        // StockReconciliationItem routes (READ-ONLY — append-only/event-sourced entity; writes arrive via the event handlers)
        .merge(create_stock_reconciliation_item_read_routes(services.stock_reconciliation_item))
        // PackageType routes (12 Backbone endpoints)
        .merge(create_package_type_routes(services.package_type))
        // StorageCategory routes (12 Backbone endpoints)
        .merge(create_storage_category_routes(services.storage_category))
        // StorageCategoryCapacity routes (12 Backbone endpoints)
        .merge(create_storage_category_capacity_routes(services.storage_category_capacity))
        // PutawayRule routes (12 Backbone endpoints)
        .merge(create_putaway_rule_routes(services.putaway_rule))
        // Lot routes (12 Backbone endpoints)
        .merge(create_lot_routes(services.lot))
        // Package routes (12 Backbone endpoints)
        .merge(create_package_routes(services.package))
        // Warehouse routes (12 Backbone endpoints)
        .merge(create_warehouse_routes(services.warehouse))
        // StockItem routes (12 Backbone endpoints)
        .merge(create_stock_item_routes(services.stock_item))
}

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

    pub fn picking_batch_routes(service: Arc<PickingBatchService>) -> Router {
        create_picking_batch_read_routes(service)
    }

    pub fn delivery_note_routes(service: Arc<DeliveryNoteService>) -> Router {
        create_delivery_note_read_routes(service)
    }

    pub fn delivery_note_item_routes(service: Arc<DeliveryNoteItemService>) -> Router {
        create_delivery_note_item_read_routes(service)
    }

    pub fn inventory_company_setting_routes(service: Arc<InventoryCompanySettingService>) -> Router {
        create_inventory_company_setting_routes(service)
    }

    pub fn landed_cost_routes(service: Arc<LandedCostService>) -> Router {
        create_landed_cost_read_routes(service)
    }

    pub fn landed_cost_line_routes(service: Arc<LandedCostLineService>) -> Router {
        create_landed_cost_line_read_routes(service)
    }

    pub fn landed_cost_adjustment_line_routes(service: Arc<LandedCostAdjustmentLineService>) -> Router {
        create_landed_cost_adjustment_line_read_routes(service)
    }

    pub fn location_routes(service: Arc<LocationService>) -> Router {
        create_location_routes(service)
    }

    pub fn stock_move_routes(service: Arc<StockMoveService>) -> Router {
        create_stock_move_read_routes(service)
    }

    pub fn stock_move_line_routes(service: Arc<StockMoveLineService>) -> Router {
        create_stock_move_line_read_routes(service)
    }

    pub fn operation_type_routes(service: Arc<OperationTypeService>) -> Router {
        create_operation_type_routes(service)
    }

    pub fn transfer_routes(service: Arc<TransferService>) -> Router {
        create_transfer_read_routes(service)
    }

    pub fn route_routes(service: Arc<RouteService>) -> Router {
        create_route_routes(service)
    }

    pub fn route_rule_routes(service: Arc<RouteRuleService>) -> Router {
        create_route_rule_routes(service)
    }

    pub fn reordering_rule_routes(service: Arc<ReorderingRuleService>) -> Router {
        create_reordering_rule_routes(service)
    }

    pub fn purchase_receipt_routes(service: Arc<PurchaseReceiptService>) -> Router {
        create_purchase_receipt_read_routes(service)
    }

    pub fn purchase_receipt_item_routes(service: Arc<PurchaseReceiptItemService>) -> Router {
        create_purchase_receipt_item_read_routes(service)
    }

    pub fn quant_routes(service: Arc<QuantService>) -> Router {
        create_quant_read_routes(service)
    }

    pub fn scrap_routes(service: Arc<ScrapService>) -> Router {
        create_scrap_read_routes(service)
    }

    pub fn scrap_reason_tag_routes(service: Arc<ScrapReasonTagService>) -> Router {
        create_scrap_reason_tag_routes(service)
    }

    pub fn stock_entry_routes(service: Arc<StockEntryService>) -> Router {
        create_stock_entry_read_routes(service)
    }

    pub fn stock_entry_item_routes(service: Arc<StockEntryItemService>) -> Router {
        create_stock_entry_item_read_routes(service)
    }

    pub fn stock_ledger_entry_routes(service: Arc<StockLedgerEntryService>) -> Router {
        create_stock_ledger_entry_read_routes(service)
    }

    pub fn bin_routes(service: Arc<BinService>) -> Router {
        create_bin_read_routes(service)
    }

    pub fn stock_reconciliation_routes(service: Arc<StockReconciliationService>) -> Router {
        create_stock_reconciliation_read_routes(service)
    }

    pub fn stock_reconciliation_item_routes(service: Arc<StockReconciliationItemService>) -> Router {
        create_stock_reconciliation_item_read_routes(service)
    }

    pub fn package_type_routes(service: Arc<PackageTypeService>) -> Router {
        create_package_type_routes(service)
    }

    pub fn storage_category_routes(service: Arc<StorageCategoryService>) -> Router {
        create_storage_category_routes(service)
    }

    pub fn storage_category_capacity_routes(service: Arc<StorageCategoryCapacityService>) -> Router {
        create_storage_category_capacity_routes(service)
    }

    pub fn putaway_rule_routes(service: Arc<PutawayRuleService>) -> Router {
        create_putaway_rule_routes(service)
    }

    pub fn lot_routes(service: Arc<LotService>) -> Router {
        create_lot_routes(service)
    }

    pub fn package_routes(service: Arc<PackageService>) -> Router {
        create_package_routes(service)
    }

    pub fn warehouse_routes(service: Arc<WarehouseService>) -> Router {
        create_warehouse_routes(service)
    }

    pub fn stock_item_routes(service: Arc<StockItemService>) -> Router {
        create_stock_item_routes(service)
    }

}