Skip to main content
Version: 🚧 Canary

🚀 Profile Features

Profile features provide complete, pre-composed functionality for profile relationship 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

Profile features are designed to:

  • Provide complete API endpoints for profile relationship 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
  • Support social relationships including follows, organization follows, and product likes

📋 Feature Structure

Each profile feature follows a consistent composition pattern:

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

🔧 Available Profile Features

createProfileFollowFeature

Profile follow creation feature with schema validation and routing.

Purpose: Provides complete profile follow creation functionality with automatic duplicate prevention, validation, and proper error handling.

Composition:

Usage:

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

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

API Endpoint: PUT /api/profiles/:profileId/profile-follows/:followProfileId


deleteProfileFollowFeature

Profile follow deletion feature with schema validation and routing.

Purpose: Provides complete profile follow deletion (unfollow) functionality with validation and proper error handling.

Composition:

Usage:

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

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

API Endpoint: DELETE /api/profiles/:profileId/profile-follows/:followProfileId


getProfileFollowersFeature

Profile followers retrieval feature with schema validation and routing.

Purpose: Provides complete profile followers retrieval functionality with validation, pagination, and avatar normalization.

Composition:

Usage:

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

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

API Endpoint: GET /api/profiles/:profileId/followers


createOrganizationFollowFeature

Organization follow creation feature with schema validation and routing.

Purpose: Provides complete organization follow creation functionality with validation and proper error handling.

Composition:

Usage:

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

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

API Endpoint: PUT /api/profiles/:profileId/organization-follows/:followOrganizationId


deleteOrganizationFollowFeature

Organization follow deletion feature with schema validation and routing.

Purpose: Provides complete organization follow deletion functionality with validation and proper error handling.

Composition:

Usage:

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

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

API Endpoint: DELETE /api/profiles/:profileId/organization-follows/:followOrganizationId


createProductLikeFeature

Product like creation feature with schema validation and routing.

Purpose: Provides complete product like creation functionality with validation and proper error handling.

Composition:

Usage:

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

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

API Endpoint: PUT /api/profiles/:profileId/product-likes/:likeProductId


deleteProductLikeFeature

Product like deletion feature with schema validation and routing.

Purpose: Provides complete product like deletion functionality with validation and proper error handling.

Composition:

Usage:

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

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

API Endpoint: DELETE /api/profiles/:profileId/product-likes/:likeProductId