From 36367b3d9770a29f2e516e40524c5d4eef8a9aca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Sun, 7 Apr 2024 04:00:49 +0200 Subject: [PATCH 1/1] Append dances and subscriptions to findAllIndexed results --- Repository/GoogleTokenRepository.php | 87 +++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 16 deletions(-) diff --git a/Repository/GoogleTokenRepository.php b/Repository/GoogleTokenRepository.php index fa2a854..7c96e72 100644 --- a/Repository/GoogleTokenRepository.php +++ b/Repository/GoogleTokenRepository.php @@ -29,20 +29,51 @@ class GoogleTokenRepository extends Repository { //Set the request $req = <<addScalarResult('cmails', 'cmails', 'string') ->addScalarResult('csummaries', 'csummaries', 'string') ->addScalarResult('csynchronizeds', 'csynchronizeds', 'string') + ->addScalarResult('dids', 'dids', 'string') + ->addScalarResult('sids', 'sids', 'string') ->addIndexByScalar('tid'); //Set result array @@ -98,10 +131,12 @@ SQL; 'access' => $token['access'], 'refresh' => $token['refresh'], 'expired' => $token['expired'], - 'calendars' => [] + 'calendars' => [], + 'dances' => [], + 'subscriptions' => [] ]; - //Iterate on + //Iterate on calendars foreach($cids as $k => $cid) { $result[$tid]['calendars'][$cid] = [ 'id' => $cid, @@ -110,6 +145,26 @@ SQL; 'synchronized' => $csynchronizeds[$k] ]; } + + //Set dids + $dids = explode("\n", $token['dids']); + + //Iterate on dances + foreach($dids as $k => $did) { + $result[$tid]['dances'][$did] = [ + 'id' => $did + ]; + } + + //Set sids + $sids = explode("\n", $token['sids']); + + //Iterate on subscriptions + foreach($sids as $k => $sid) { + $result[$tid]['subscriptions'][$sid] = [ + 'id' => $sid + ]; + } } //Return result -- 2.41.1