🏷️ 属性ルートブロック
属性ルートブロックは、Nodeblocks アプリケーションにおける属性グループ管理操作のための事前構成済み HTTP エンドポイントを提供します。これらのルートはハンドラー、バリデーター、ミドルウェアを組み合わせ、適切な認証・認可・エラー処理を備えた完全な API エンドポイントを作成します。
🎯 概要
属性ルートブロックは次のことを目的として設計されています:
- 属性グループ管理操作のための完全な API エンドポイントを提供する
- 安全な操作のためにハンドラーとバリデーターを組み合わせる
- 認証および認可のチェックを含める
- 関数的な合成パターンをサポートする
- ロギングとエラー管理を自動で処理する
📋 ルートの構成
各属性ルートは一貫したパターンに従います:
- HTTP メソッド: 操作の種類を定義します(GET、POST、PATCH、DELETE)
- パス: パラメータ付きでエンドポイント URL を指定します
- ハンドラー: ビジネスロジックのための合成関数チェーン
- バリデーター: 認証および認可のチェック
🔧 利用可能な属性ルート
createAttributeRoute
新しい属性グループを作成し、作成されたリソースを返します。
目的: 属性グループの作成を処理します
ルート詳細:
- メソッド:
POST
- パス:
/attributes
- 認証: 必須(Bearer トークン)
ハンドラー: createAttributeGroup
, getAttributeGroupById
, createAttributeGroupTerminator
バリデーター: isAuthenticated
, checkIdentityType
(['admin'])
使用例:
import { routes } from '@nodeblocks/backend-sdk';
// Express アプリにルートを登録
app.use('/api', routes.createAttributeRoute);
findAttributesRoute
正規化された一覧形式ですべての属性グループを取得します。
目的: ページネーション付きで属性グループを一覧表示します
ルート詳細:
- メソッド:
GET
- パス:
/attributes
- 認証: 不要
ハンドラー: findAttributeGroups
, normalizeAttributesListTerminator
バリデーター: なし
使用例:
import { routes } from '@nodeblocks/backend-sdk';
// Express アプリにルートを登録
app.use('/api', routes.findAttributesRoute);
getAttributeRoute
ID によって特定の属性グループを取得します。
目的: 属性グループデータを取得します
ルート詳細:
- メソッド:
GET
- パス:
/attributes/:attributeId
- 認証: 不要
ハンドラー: getAttributeGroupById
, normalizeAttributeGroupTerminator
バリデーター: なし
使用例:
import { routes } from '@nodeblocks/backend-sdk';
// Express アプリにルートを登録
app.use('/api', routes.getAttributeRoute);
updateAttributeRoute
既存の属性グループを更新し、更新されたリソースを返します。
目的: 属性グループデータを変更します
ルート詳細:
- メソッド:
PATCH
- パス:
/attributes/:attributeId
- 認証: 必須(Bearer トークン)
ハンドラー: updateAttributeGroup
, getAttributeGroupById
, normalizeAttributeGroupTerminator
バリデーター: isAuthenticated
, checkIdentityType
(['admin'])
使用例:
import { routes } from '@nodeblocks/backend-sdk';
// Express アプリにルートを登録
app.use('/api', routes.updateAttributeRoute);
deleteAttributeRoute
ID によって属性グループを削除します。
目的: 属性グループを削除します
ルート詳細:
- メソッド:
DELETE
- パス:
/attributes/:attributeId
- 認証: 必須(Bearer トークン)
ハンドラー: deleteAttributeGroup
, deleteAttributeTerminator
バリデーター: isAuthenticated
, checkIdentityType
(['admin'])
使用例:
import { routes } from '@nodeblocks/backend-sdk';
// Express アプリにルートを登録
app.use('/api', routes.deleteAttributeRoute);