Skip to main content
Version: 0.9.0 (Latest)

👥 Profile Blocks

Profile blocks provide comprehensive functionality for managing social profile relationships and user engagement in NodeBlocks applications. These blocks handle profile follows, organization follows, and product likes with proper error management and data normalization.


🎯 Overview

Profile blocks are designed to:

  • Manage profile relationships including follows and social connections
  • Handle organization follows for user subscriptions
  • Support product likes for user engagement tracking
  • Normalize social data with avatar integration
  • Ensure type safety with comprehensive error handling
  • Support composition with other profile operations

📦 Block Types

🔍 Schemas

JSON Schema definitions for profile data validation:

  • createProfileFollowSchema: Profile follow creation validation with path parameter validation
  • deleteProfileFollowSchema: Profile follow deletion validation with path parameter validation
  • getProfileFollowersSchema: Profile followers retrieval validation with path parameter validation
  • createOrganizationFollowSchema: Organization follow creation validation with path parameter validation
  • deleteOrganizationFollowSchema: Organization follow deletion validation with path parameter validation
  • createProductLikeSchema: Product like creation validation with path parameter validation
  • deleteProductLikeSchema: Product like deletion validation with path parameter validation

View Profile Schemas →

🔧 Blocks

Pure business logic functions for profile operations:

  • createProfileFollow: Creates follow relationships between profiles with duplicate prevention
  • deleteProfileFollow: Removes follow relationships between profiles (unfollowing)
  • normalizeFollowers: Normalizes follower data by converting avatar objectIds to accessible URLs
  • buildProfileFollowersByFollowProfileIdQuery: Builds MongoDB filter for finding profiles that follow a specific profile
  • createOrganizationFollow: Creates organization follow relationships between profiles and organizations
  • deleteOrganizationFollow: Removes organization follow relationships from profiles (unfollowing organizations)
  • createProductLike: Creates product like relationships between profiles and products with duplicate prevention
  • deleteProductLike: Removes product like relationships from profiles (unliking products)

Error Classes:

  • ProfileBlockError: Base error class for profile-related block operations
  • ProfileNotFoundBlockError: Profile not found error
  • ProfileAlreadyFollowedBlockError: Profile already followed error
  • ProfileFollowNotFoundBlockError: Profile follow relationship not found error
  • ProfileUnexpectedDBError: Unexpected database error for profile operations
  • ProfileDbBlockError: Profile database operation error
  • OrganizationAlreadyFollowedBlockError: Organization already followed error
  • OrganizationFollowNotFoundBlockError: Organization follow relationship not found error
  • ProductAlreadyLikedBlockError: Product already liked error
  • ProductLikeNotFoundBlockError: Product like relationship not found error

View Profile Blocks →

🛣️ Routes

HTTP endpoint definitions for profile operations:

  • createProfileFollowRoute: PUT /profiles/:profileId/profile-follows/:followProfileId with follow creation
  • deleteProfileFollowRoute: DELETE /profiles/:profileId/profile-follows/:followProfileId with follow deletion
  • getProfileFollowersRoute: GET /profiles/:profileId/followers with followers retrieval and pagination
  • createOrganizationFollowRoute: PUT /profiles/:profileId/organization-follows/:followOrganizationId with organization follow creation
  • deleteOrganizationFollowRoute: DELETE /profiles/:profileId/organization-follows/:followOrganizationId with organization follow deletion
  • createProductLikeRoute: PUT /profiles/:profileId/product-likes/:likeProductId with product like creation
  • deleteProductLikeRoute: DELETE /profiles/:profileId/product-likes/:likeProductId with product like deletion

View Profile Routes →

🚀 Features

Complete profile management features combining schemas, routes, and handlers:

  • createProfileFollowFeature: Profile follow creation with schema validation and routing
  • deleteProfileFollowFeature: Profile follow deletion with schema validation and routing
  • getProfileFollowersFeature: Profile followers retrieval with schema validation, pagination, and routing
  • createOrganizationFollowFeature: Organization follow creation with schema validation and routing
  • deleteOrganizationFollowFeature: Organization follow deletion with schema validation and routing
  • createProductLikeFeature: Product like creation with schema validation and routing
  • deleteProductLikeFeature: Product like deletion with schema validation and routing

View Profile Features →