🏷️ 属性ブロック
属性ブロックは、Nodeblocksアプリケーションで属性グループ(キー・バリューセットのコレクション)を管理するための包括的な機能を提供します。これらのブロックは、厳密なバリデーションと明確なAPI契約により、作成、更新、取得、一覧表示、削除を処理します。
🎯 概要
属性ブロックは以下の目的で設計されています:
- 属性グループの管理 - キー・バリューペア構造を使用
- バリデーションの実施 - JSON Schemaによる検証
- 検索とフィルタリング機能の有効化
- CRUD操作の提供 - 属性ライフサイクル管理のための操作
- ページネーションのサポート - 一覧エンドポイントでの対応
📦 ブロックタイプ
🔍 スキーマ
属性データのバリデーション用JSON Schema定義:
- attributesSchema: 基本属性グループ構造(name、items)
- createAttributesSchema: 属性グループ作成時のバリデーション(name、items必須)
- updateAttributesSchema: 属性グループ更新時のバリデーション(nameはオプション)
- getAttributeSchema: 単一属性グループの取得(path: attributeId)
- deleteAttributeSchema: 属性グループの削除(path: attributeId)
- findAttributesSchema: 属性グループの検索(query: name、page、limit)
⚙️ ハンドラー
属性操作のコアビジネスロジック:
- createAttributeGroup: 属性グループの作成
- getAttributeGroupById: IDによる属性グループの取得
- findAttributeGroups: 属性グループの検索と一覧表示
- updateAttributeGroup: 属性グループの更新
- deleteAttributeGroup: 属性グループの削除
🛣️ ルート
属性操作のHTTPエンドポイント定義:
- createAttributeRoute: POST
/attributes(認証: Bearer + admin) - getAttributeRoute: GET
/attributes/:attributeId - findAttributesRoute: GET
/attributes(ページネーション対応) - updateAttributeRoute: PATCH
/attributes/:attributeId(認証: Bearer + admin) - deleteAttributeRoute: DELETE
/attributes/:attributeId(認証: Bearer + admin)
🚀 機能
schemas、routes、handlersを組み合わせた完全な属性管理機能:
- createAttributeFeature: バリデーションとルーティングを含む作成フロー
- getAttributeFeature: 単一グループの取得フロー
- findAttributesFeature: オプションのフィルタリングとページネーションを含む一覧表示
- updateAttributeFeature: バリデーションとアクセス制御を含む更新フロー
- deleteAttributeFeature: アクセス制御を含む削除フロー