メインコンテンツまでスキップ
バージョン: 0.5.0 (最新)

🏢 Organization 機能ブロック

Organization 機能ブロックは、NodeBlocks アプリケーションにおける組織管理操作のための完全な事前構成済み機能を提供します。これらの機能は、スキーマ、ルート、ハンドラーを組み合わせ、組織の CRUD 操作、ユーザー管理、メンバーシップ処理のためのすぐに使用できる API エンドポイントを作成します。


🎯 概要

Organization 機能ブロックは以下を目的として設計されています:

  • 完全な組織管理を提供 完全な CRUD 操作付き
  • 組織内のユーザー会員資格と役割管理をサポート
  • 安全な組織操作のための検証とルーティングを含む
  • 組織とユーザーリストのフィルタリングとページネーションをサポート
  • 組織-ユーザー関係とアクセス制御を処理

📋 機能構造

各組織機能は、一貫した構成パターンに従います:

  • スキーマ: 組織の入力データとパラメータを検証
  • ルート: 組織ハンドラー付きの HTTP エンドポイントを提供
  • 構成: compose 関数を使用してスキーマとルートを組み合わせ

🔧 利用可能な Organization 機能

createOrganizationFeature

スキーマ検証とルーティング付きの組織作成機能。

目的: 完全な検証で組織作成を処理

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.createOrganizationFeature));

// データベース構成付き
app.use('/api', defService(partial(features.createOrganizationFeature, [{ dataStores: db }])));

API エンドポイント: POST /api/organizations


getOrganizationFeatures

個別の組織データを取得するための組織取得機能。

目的: 適切な検証で組織情報を取得

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.getOrganizationFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.getOrganizationFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/:organizationId


findOrganizationsFeatures

フィルタリングとページネーション付きの組織検索機能。

目的: 検索機能を備えた組織リストを提供

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.findOrganizationsFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.findOrganizationsFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations


editOrganizationFeatures

スキーマ検証とルーティング付きの組織更新機能。

目的: 適切な検証で組織情報を変更

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.editOrganizationFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.editOrganizationFeatures, [{ dataStores: db }])));

API エンドポイント: PATCH /api/organizations/:organizationId


deleteOrganizationFeatures

ルーティング付きの組織削除機能。

目的: アクセス制御とクリーンアップで組織を削除

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.deleteOrganizationFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.deleteOrganizationFeatures, [{ dataStores: db }])));

API エンドポイント: DELETE /api/organizations/:organizationId


getOrganizationMemberFeatures

組織内のメンバー役割を取得するための組織メンバー役割取得機能。

目的: 特定の組織内のメンバー役割を取得

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.getOrganizationMemberFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.getOrganizationMemberFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/:organizationId/members/:identityId/role


checkOrganizationMemberExistenceFeatures

メンバーの会員資格を検証するための組織メンバー存在チェック機能。

目的: 組織内のメンバー会員資格を検証

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.checkOrganizationMemberExistenceFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.checkOrganizationMemberExistenceFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/:organizationId/members/check-existence


findOrganizationMembersFeatures

フィルタリングとページネーション付きの組織メンバー検索機能。

目的: 検索機能を備えた組織メンバーリストを提供

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.findOrganizationMembersFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.findOrganizationMembersFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/:organizationId/members


findOrganizationsForMemberFeatures

ID による組織検索のためのメンバーの組織検索機能。

目的: 特定のメンバー(アイデンティティ)に関連付けられた組織を検索、オプションで役割フィルタリングと継承役割付き

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.findOrganizationsForMemberFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.findOrganizationsForMemberFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/members/:identityId


editOrganizationMembersFeatures

メンバーのアップサートのためのスキーマ検証付きの組織メンバー管理機能。

目的: 組織内のメンバー会員資格と役割を管理

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.editOrganizationMembersFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.editOrganizationMembersFeatures, [{ dataStores: db }])));

API エンドポイント: PATCH /api/organizations/:organizationId/members


deleteOrganizationMemberFeatures

ルーティング付きの組織メンバー削除機能。

目的: 適切なクリーンアップで組織からメンバーを削除

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.deleteOrganizationMemberFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.deleteOrganizationMemberFeatures, [{ dataStores: db }])));

API エンドポイント: DELETE /api/organizations/:organizationId/members/:identityId


findOrganizationDescendantsFeatures

指定された組織の子孫組織を取得します。

目的: ページネーションサポート付きで全子孫をリスト

構成:

使用法:

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

// 直接使用(ハンドラーで dataStores が必要)
app.use('/api', defService(features.findOrganizationDescendantsFeatures));

// データベース構成付き
app.use('/api', defService(partial(features.findOrganizationDescendantsFeatures, [{ dataStores: db }])));

API エンドポイント: GET /api/organizations/:organizationId/descendants


getLogoUploadUrlFeature

スキーマ検証とルーティング付きの組織ロゴアップロード URL 生成機能。

目的: 組織ロゴをアップロードするための署名付き URL を生成します。

構成:

  • スキーマ: getSignedImageUploadUrlSchema - 画像アップロード用のコンテンツタイプとファイルサイズを検証
  • ルート: getLogoUploadUrlRoute - 署名付き URL 生成付きの GET /organizations/:organizationId/logo-upload-url

使用法:

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

// ファイルストレージサービスを構成に含めて:
app.use(
'/api',
defService(partial(features.getLogoUploadUrlFeature, [{ configuration: { fileStorageDriver } }]))
);

API エンドポイント: GET /api/organizations/:organizationId/logo-upload-url