Skip to main content
Version: 0.5.0 (Previous)

🏢 Organization Feature Blocks

Organization feature blocks provide complete, pre-composed functionality for organization management operations in Nodeblocks applications. These features combine schemas, routes, and handlers to create ready-to-use API endpoints for organization CRUD operations, user management, and membership handling.


🎯 Overview

Organization feature blocks are designed to:

  • Provide complete organization management with full CRUD operations
  • Support user membership and role management within organizations
  • Include validation and routing for secure organization operations
  • Support filtering and pagination for organization and user listings
  • Handle organization-user relationships and access control

📋 Feature Structure

Each organization feature follows a consistent composition pattern:

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

🔧 Available Organization Features

createOrganizationFeature

Organization creation feature with schema validation and routing.

Purpose: Handles organization creation with complete validation

Composition:

Usage:

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


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

API Endpoint: POST /api/organizations


getOrganizationFeatures

Organization retrieval feature for getting individual organization data.

Purpose: Fetches organization information with proper validation

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/:organizationId


findOrganizationsFeatures

Organization search feature with filtering and pagination.

Purpose: Provides organization listing with search capabilities

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations


editOrganizationFeatures

Organization update feature with schema validation and routing.

Purpose: Modifies organization information with proper validation

Composition:

Usage:

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


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

API Endpoint: PATCH /api/organizations/:organizationId


deleteOrganizationFeatures

Organization deletion feature with routing.

Purpose: Removes organizations with access control and cleanup

Composition:

Usage:

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


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

API Endpoint: DELETE /api/organizations/:organizationId


getOrganizationMemberFeatures

Organization member role retrieval feature for getting member roles within organizations.

Purpose: Retrieves member roles within specific organizations

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/:organizationId/members/:identityId/role


checkOrganizationMemberExistenceFeatures

Organization member existence check feature for validating member membership.

Purpose: Validates member membership in organizations

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/:organizationId/members/check-existence


findOrganizationMembersFeatures

Organization members search feature with filtering and pagination.

Purpose: Provides organization member listing with search capabilities

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/:organizationId/members


findOrganizationsForMemberFeatures

Organizations for member search feature for finding organizations by identity ID.

Purpose: Finds organizations associated with a specific member (identity), with optional role filtering and inherited roles

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/members/:identityId


editOrganizationMembersFeatures

Organization member management feature with schema validation for upserting members.

Purpose: Manages member membership and roles within organizations

Composition:

Usage:

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


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

API Endpoint: PATCH /api/organizations/:organizationId/members


deleteOrganizationMemberFeatures

Organization member deletion feature with routing.

Purpose: Removes members from organizations with proper cleanup

Composition:

Usage:

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


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

API Endpoint: DELETE /api/organizations/:organizationId/members/:identityId


findOrganizationDescendantsFeatures

Retrieves descendant organizations for a given organization.

Purpose: Lists all descendants with pagination support

Composition:

Usage:

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


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

API Endpoint: GET /api/organizations/:organizationId/descendants


getLogoUploadUrlFeature

Organization logo upload URL generation feature with schema validation and routing.

Purpose: Generates a pre-signed URL to upload an organization logo.

Composition:

Usage:

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

// With file storage service in configuration:
app.use(
'/api',
defService(partial(features.getLogoUploadUrlFeature, [{ configuration: { fileStorageDriver } }]))
);

API Endpoint: GET /api/organizations/:organizationId/logo-upload-url