📂 Category Blocks
Category blocks provide comprehensive functionality for managing hierarchical category structures in Nodeblocks applications. These blocks handle category creation, updates, retrieval, and search operations with support for parent-child relationships.
🎯 Overview
Category blocks are designed to:
- Manage hierarchical categories with parent-child relationships
- Support category lifecycle with enable/disable operations
- Enable category search and filtering capabilities
- Provide CRUD operations for category management
- Support pagination for large category collections
📦 Block Types
🔍 Schemas
JSON Schema definitions for category data validation:
- categorySchema: Base category structure
- createCategorySchema: Category creation validation
- updateCategorySchema: Category modifications
- getCategorySchema: Category retrieval
- deleteCategorySchema: Category deletion
- enableCategorySchema: Category activation
- disableCategorySchema: Category deactivation
- findCategoriesSchema: Category search with filtering and pagination
⚙️ Handlers
Core business logic for category operations:
- createCategory: Category creation with hierarchy support
- getCategoryById: Category data retrieval
- findCategories: Category search and filtering
- updateCategory: Category modifications
- enableCategory: Category activation
- disableCategory: Category deactivation
- deleteCategory: Category deletion with cleanup
🛣️ Routes
HTTP endpoint definitions for category operations:
- createCategoryRoute: POST
/categories(auth: Bearer + admin) - getCategoryRoute: GET
/categories/:categoryId - findCategoriesRoute: GET
/categories(pagination supported) - updateCategoryRoute: PATCH
/categories/:categoryId(auth: Bearer + admin) - enableCategoryRoute: POST
/categories/:categoryId/enable(auth: Bearer + admin) - disableCategoryRoute: POST
/categories/:categoryId/disable(auth: Bearer + admin) - deleteCategoryRoute: DELETE
/categories/:categoryId(auth: Bearer + admin)
🚀 Features
Complete category management features combining schemas, routes, and handlers:
- createCategoryFeature: Category creation with validation and routing
- getCategoryFeatures: Category retrieval with access control
- findCategoriesFeatures: Category search with filtering and pagination
- editCategoryFeatures: Category updates with validation and access control
- enableCategoryStatusFeatures: Category activation functionality
- disableCategoryStatusFeatures: Category deactivation functionality
- editCategoryStatusFeatures: Complete category status management
- deleteCategoryFeatures: Category deletion with proper validation and cleanup
✅ Validators
Validation functions for category operations:
- doesCategoryExist: Validates category existence before operations
🔗 Related Documentation
- Category Schemas - Category data validation and contracts
- Category Handlers - Business logic and category operations
- Category Routes - HTTP endpoint definitions
- Category Features - Complete category management features
- Category Validators - Category validation functions