Jake Vanderwerf
2026-08-26 18e7e415339ccc9adf8ade562f93abef606da16d
inc/rest/routes/Invitations.php
@@ -2,7 +2,9 @@
namespace JVBase\rest\routes;
use JVBase\Instance;
use JVBase\managers\Cache;
use JVBase\managers\InvitationsManager;
use JVBase\managers\Roles;
use JVBase\rest\Rest;
use JVBase\managers\CustomTable;
use JVBase\rest\Route;
@@ -25,20 +27,18 @@
   use Instance;
   protected array $inviteConfig;
   protected CustomTable $table;
   protected Cache $termCache;
   public function __construct()
   {
      $this->cacheName = 'invitations';
      parent::__construct();
      $this->cache = Cache::for('invitations_posts','post');
      $this->termCache = Cache::for('invitation_terms', 'term');
      // Get invitation configuration
      $this->inviteConfig = InvitationsManager::getInstance()->getInviteConfig();
      $this->table = CustomTable::for('invitations');
      // Cache connections
      $this->cache
         ->connect('user')
         ->connect('taxonomy');
   }
   public function registerRoutes(): void
@@ -80,7 +80,7 @@
      }
      $args = [
         'user' => $userID,
         'id' => $userID,
         'to_term' => $termID,
         'taxonomy' => $taxonomy ? jvbNoBase($taxonomy) : null,
         'status' => $request->get_param('status'),
@@ -88,8 +88,8 @@
      ];
      // Check cache
      $key = $this->cache->generateKey($args);
      if ($cached = $this->cache->get($key)) {
      if ($cached = $this->cache->get($args)) {
         return $this->success($cached);
      }
@@ -99,7 +99,7 @@
         : $this->getUserInvitations($args);
      // Cache result
      $this->cache->set($key, $result);
      $this->cache->set($args, $result);
      return $this->success($result);
   }
@@ -107,7 +107,7 @@
   /**
    * Get invitations for a specific term
    */
   protected function getTermInvitations(array $args): array
   public function getTermInvitations(array $args): array
   {
      // Check permission
      if (!Roles::getInstance()()->isManager($args['user'], $args['to_term'])) {