Skip to main content
Version: 0.6.0 (Latest)

🚀 Attribute Feature Blocks

Attribute feature blocks provide complete, pre-composed functionality for attribute group 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 group management operations
  • Combine schemas with routes for validated operations
  • Include authentication and authorization checks (for mutating operations)
  • 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 group 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 (auth: Bearer, admin)


getAttributeFeature

Retrieves individual attribute set data with access control.

Purpose: Fetches attribute group data

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 group listing with search and pagination

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 group data (auth required)

Composition:

Usage:

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


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

API Endpoint: PATCH /api/attributes/:attributeId (auth: Bearer, admin)


deleteAttributeFeature

Deletes attribute sets with proper authorization.

Purpose: Removes attribute groups (auth required)

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 (auth: Bearer, admin)