🚀 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
composefunction
🔧 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:
- Schema:
createProfileFollowSchema- validates profile follow request path parameters - Route:
createProfileFollowRoute- PUT/profiles/:profileId/profile-follows/:followProfileIdwith follow creation handler
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:
- Schema:
deleteProfileFollowSchema- validates profile follow deletion request path parameters - Route:
deleteProfileFollowRoute- DELETE/profiles/:profileId/profile-follows/:followProfileIdwith follow deletion handler
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:
- Schema:
getProfileFollowersSchema- validates profile followers retrieval request path parameters - Route:
getProfileFollowersRoute- GET/profiles/:profileId/followerswith followers retrieval handler
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:
- Schema:
createOrganizationFollowSchema- validates organization follow creation request path parameters - Route:
createOrganizationFollowRoute- PUT/profiles/:profileId/organization-follows/:followOrganizationIdwith follow creation handler
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:
- Schema:
deleteOrganizationFollowSchema- validates organization follow deletion request path parameters - Route:
deleteOrganizationFollowRoute- DELETE/profiles/:profileId/organization-follows/:followOrganizationIdwith follow deletion handler
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:
- Schema:
createProductLikeSchema- validates product like creation request path parameters - Route:
createProductLikeRoute- PUT/profiles/:profileId/product-likes/:likeProductIdwith like creation handler
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:
- Schema:
deleteProductLikeSchema- validates product like deletion request path parameters - Route:
deleteProductLikeRoute- DELETE/profiles/:profileId/product-likes/:likeProductIdwith like deletion handler
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
🔗 Related Documentation
- Profile Schemas - Profile data validation and contracts
- Profile Blocks - Profile business logic functions
- Profile Routes - HTTP endpoint definitions