Jake Vanderwerf
2026-01-22 58e8ae0759ccfa97c478ccae4e0778bdce70966f
inc/rest/routes/ContentRoutes.php
@@ -3,6 +3,8 @@
namespace JVBase\rest\routes;
use JVBase\JVB;
use JVBase\managers\queue\executors\ContentExecutor;
use JVBase\managers\queue\TypeConfig;
use JVBase\rest\RestRouteManager;
use JVBase\managers\CacheManager;
use JVBase\meta\MetaManager;
@@ -30,17 +32,38 @@
   protected array $timelineSharedFields = [];
   protected array $timelineUniqueFields = [];
   //TODO: Ensure we are handling the bulk operations for all processes
   //TODO: Also invalidate feed caches on updates!!
   public function __construct()
   {
      $this->cache_name = 'user_content_' . get_current_user_id();
      parent::__construct();
      $this->cache->clear();
      if (JVB_TESTING) {
         $this->cache->clear();
      }
      $this->action = 'dash-';
      $this->operation_type = 'content_update';
      add_filter(BASE . 'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
      add_action('init', [$this, 'registerContentExecutors'], 5);
   }
   /**
    * Register content operation types with the queue's TypeRegistry
    */
   public function registerContentExecutors(): void
   {
      $registry = JVB()->queue()->registry();
      $executor = new ContentExecutor();
      // Content updates - chunked at 10 posts
      $registry->register('content_update', new TypeConfig(
         executor: $executor,
         chunkKey: 'posts',
         chunkSize: 10
      ));
      // Batch creation (from uploads)
      $registry->register('batch_creation', new TypeConfig(
         executor: $executor
      ));
   }
   /**
@@ -593,6 +616,8 @@
         return ['success' => false, 'message' => 'No permission'];
      }
      error_log('[Processing Timeline Post...');
      $ignore = ['content', 'user'];
      $this->fields = jvbGetFields($post_data['content']);
      $this->initTimelineFields($post_data['content']);
@@ -681,7 +706,8 @@
         ]);
         $prevDate = null;
         $latest_date = null;
         $earliest_date = null;
         foreach ($post_data['timeline'] as $order => $timeline) {
            // Get unique fields for this specific timeline entry
            $allowedFields = array_filter($timeline, function ($key) use ($ignore) {