Skip to main content
Version: 0.4.2 (Previous)

🚀 Attribute Feature Blocks

Attribute feature blocks provide complete, pre-composed functionality for attribute management operations in Nodeblocks applications. These features combine schemas and routes to create ready-to-use API endpoints with proper validation, authentication, and error handling.


🎯 Overview

Attribute feature blocks are designed to:

  • Provide complete API endpoints for attribute management operations
  • Combine schemas with routes for validated operations
  • Include authentication and authorization checks automatically
  • Support functional composition patterns
  • Handle logging and error management seamlessly

📋 Feature Structure

Each attribute feature follows a consistent composition pattern:

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

🔧 Available Attribute Features

createAttributeFeature

Creates a new attribute set with validation and routing.

Purpose: Handles attribute set creation with complete validation

Composition:

Usage:

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


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

API Endpoint: POST /api/attributes


getAttributeFeature

Retrieves individual attribute set data with access control.

Purpose: Fetches attribute set data with proper authorization

Composition:

Usage:

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


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

API Endpoint: GET /api/attributes/:attributeId


findAttributesFeature

Searches and lists attribute sets with filtering and pagination.

Purpose: Provides attribute set listing with search capabilities

Composition:

Usage:

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


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

API Endpoint: GET /api/attributes


updateAttributeFeature

Updates attribute set data with validation and access control.

Purpose: Modifies attribute set data with proper authorization

Composition:

Usage:

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


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

API Endpoint: PUT /api/attributes/:attributeId


deleteAttributeFeature

Deletes attribute sets with proper authorization.

Purpose: Removes attribute sets with access control

Composition:

Usage:

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


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

API Endpoint: DELETE /api/attributes/:attributeId