Skip to content

feat: Implement Multiple Categories per Record with Approval System

Ranjith Raj requested to merge multiple-categories into develop

This pull request introduces a comprehensive overhaul of the category system, enabling records to be associated with multiple categories and implementing a robust approval workflow for new category submissions.

Key Features & Changes:

  • Multiple Categories per Record:

    • The data model has been updated to allow a single record to be tagged with multiple categories, providing greater flexibility in content organization.
    • The implementation uses a JSON array (category_tags) on the Record model, which is more efficient than the previous many-to-many association table.
  • Category Approval System:

    • A moderation workflow has been introduced. When a user creates a new category, it is marked as "pending" and requires administrator approval to become publicly visible.
    • The Category model is updated with fields to support this workflow, including approved, created_by, and approved_by.
    • Category hierarchy is now supported via a parent_id, allowing for nested category structures.
  • API Enhancements:

    • The record creation and update endpoints now accept a list of category_ids.
    • Public API endpoints for categories will only return approved categories.
    • New admin-only endpoints have been added to manage the approval and rejection of pending categories.
  • Database Migrations:

    • A new Alembic migration is included to update the database schema with the new fields and relationships.
  • Testing:

    • Comprehensive integration tests have been added to validate the new functionality, including CRUD operations for categories, the approval workflow, and associating multiple categories with records.
Edited by Ranjith Raj

Merge request reports

Loading