メインコンテンツまでスキップ
バージョン: 0.6.0 (Latest)

📦 Order Feature Blocks

Order feature blocks provide complete, pre-composed functionality for order management operations in Nodeblocks applications. These features combine schemas, routes, and handlers to create ready-to-use API endpoints for order CRUD operations, search, and lifecycle management.


🎯 Overview

Order feature blocks are designed to:

  • Provide complete order management with full CRUD operations
  • Support order lifecycle management from creation to completion
  • Include validation and routing for secure order operations
  • Support filtering and pagination for order listings
  • Handle order items and total calculations

📋 Feature Structure

Each order feature follows a consistent composition pattern:

  • Schema: Validates order input data and parameters
  • Route: Provides HTTP endpoint with order handlers
  • Composition: Combines schema and route using compose function

🔧 Available Order Features

createOrderFeature

Order creation feature with schema validation and routing.

Purpose: Handles order creation with complete validation

Composition:

Usage:

import { features } from '@nodeblocks/backend-sdk';


// With database configuration
app.use('/api', defService(partial(features.createOrderFeature, [{ dataStores: db }])));

API Endpoint: POST /api/orders


updateOrderFeature

Order update feature with schema validation and routing.

Purpose: Modifies order information with proper validation

Composition:

Usage:

import { features } from '@nodeblocks/backend-sdk';


// With database configuration
app.use('/api', defService(partial(features.updateOrderFeature, [{ dataStores: db }])));

API Endpoint: PATCH /api/orders/:orderId


getOrderFeature

Order retrieval feature for getting individual order data.

Purpose: Fetches order information with proper validation

Composition:

Usage:

import { features } from '@nodeblocks/backend-sdk';


// With database configuration
app.use('/api', defService(partial(features.getOrderFeature, [{ dataStores: db }])));

API Endpoint: GET /api/orders/:orderId


findOrdersFeature

Order search feature with filtering and pagination.

Purpose: Provides order listing with search capabilities

Composition:

Usage:

import { features } from '@nodeblocks/backend-sdk';


// With database configuration
app.use('/api', defService(partial(features.findOrdersFeature, [{ dataStores: db }])));

API Endpoint: GET /api/orders


deleteOrderFeature

Order deletion feature with routing.

Purpose: Removes orders with access control and cleanup

Composition:

Usage:

import { features } from '@nodeblocks/backend-sdk';


// With database configuration
app.use('/api', defService(partial(features.deleteOrderFeature, [{ dataStores: db }])));

API Endpoint: DELETE /api/orders/:orderId