Skip to main content
Version: 0.9.0 (Latest)

🛒 Order Blocks

Order blocks provide comprehensive functionality for order management operations in Nodeblocks applications. These blocks handle order lifecycle operations including creation, retrieval, updates, and organization-scoped queries.


🎯 Overview

Order blocks are designed to:

  • Manage order lifecycle with full CRUD operations
  • Handle order queries with flexible filtering and pagination
  • Support organization scoping for multi-tenant order management
  • Provide type safety with comprehensive error handling
  • Enable composition for building complex order features

📦 Block Types

🔍 Schemas

JSON Schema definitions for order data validation:

  • orderSchema: Base order entity structure
  • createOrderSchema: Order creation validation
  • updateOrderSchema: Order modifications with optional field validation
  • getOrderSchema: Order retrieval validation
  • deleteOrderSchema: Order deletion validation
  • findOrdersSchema: Order search with filtering and pagination

View Order Schemas →

🔧 Blocks

Pure business logic functions for order operations:

  • findOrders: Retrieve orders with filtering and pagination
  • OrderBlockError: Base error class for order-related block operations
  • OrderDbBlockError: Database-specific error class for order block operations

View Order Blocks →

⚙️ Handlers

Core business logic for order operations:

  • createOrder: Order creation with validation
  • updateOrder: Order updates with validation and conflict detection
  • getOrderById: Order data retrieval with existence validation
  • findOrders: Order search and filtering
  • deleteOrder: Order deletion with safe deletion and existence validation
  • createOrderTerminator: Formats successful order creation response
  • normalizeOrderTerminator: Normalizes order data by removing database-specific fields
  • normalizeOrdersListTerminator: Normalizes orders list by removing database-specific fields
  • deleteOrderTerminator: Formats successful deletion response

View Order Handlers →

🛣️ Routes

HTTP endpoint definitions for order operations:

  • createOrderRoute: POST /orders with creation handler
  • getOrderRoute: GET /orders/:orderId with access control
  • findOrdersRoute: GET /orders with search and pagination
  • updateOrderRoute: PATCH /orders/:orderId with access control
  • deleteOrderRoute: DELETE /orders/:orderId with access control
  • findOrdersByOrganizationIdRoute: GET /orders/organizations/:organizationId with organization role validation

View Order Routes →

🚀 Features

Complete order management features combining schemas, routes, and handlers:

  • createOrderFeature: Order creation with validation and routing
  • updateOrderFeature: Order updates with validation and routing
  • getOrderFeature: Order retrieval with proper validation
  • findOrdersFeature: Order search with filtering and pagination
  • deleteOrderFeature: Order deletion with access control and cleanup
  • findOrdersByOrganizationIdFeature: Organization-scoped order retrieval with role-based access control

View Order Features →

Validators

Validation functions for order operations:

  • ownsOrder: Validates order ownership by the authenticated identity
  • validateOrderAccess: Validates order access based on allowed subjects and token information (deprecated)

View Order Validators →