From 79a1c1e9f3fbc0747ed24255271f31d717823cb3 Mon Sep 17 00:00:00 2001 From: Jonathan Treffler Date: Fri, 1 Nov 2024 02:52:42 +0100 Subject: [PATCH] use new more versatile tag query methods --- .../ListOrganizationFolders.php | 2 +- lib/Model/OrganizationFolder.php | 6 ++++++ lib/Service/OrganizationFolderService.php | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/Command/OrganizationFolder/ListOrganizationFolders.php b/lib/Command/OrganizationFolder/ListOrganizationFolders.php index 1355c86..c284fc9 100644 --- a/lib/Command/OrganizationFolder/ListOrganizationFolders.php +++ b/lib/Command/OrganizationFolder/ListOrganizationFolders.php @@ -19,7 +19,7 @@ class ListOrganizationFolders extends BaseCommand { protected function execute(InputInterface $input, OutputInterface $output): int { try { - $organizationFolderGroupfolders = $this->organizationFolderService->getAll(); + $organizationFolderGroupfolders = $this->organizationFolderService->findAll(); $this->writeTableInOutputFormat($input, $output, $this->formatTableSerializables($organizationFolderGroupfolders)); return 0; diff --git a/lib/Model/OrganizationFolder.php b/lib/Model/OrganizationFolder.php index 2422441..1c66d14 100644 --- a/lib/Model/OrganizationFolder.php +++ b/lib/Model/OrganizationFolder.php @@ -10,6 +10,8 @@ class OrganizationFolder implements JsonSerializable, TableSerializable { private int $id, private string $name, private int $quota, + private ?string $organizationProvider = null, + private ?int $organizationId = null, ) { } @@ -30,6 +32,8 @@ class OrganizationFolder implements JsonSerializable, TableSerializable { 'id' => $this->id, 'name' => $this->name, 'quota' => $this->quota, + 'organizationProvider' => $this->organizationProvider, + 'organizationId' => $this->organizationId, ]; } @@ -38,6 +42,8 @@ class OrganizationFolder implements JsonSerializable, TableSerializable { 'Id' => $this->id, 'Name' => $this->name, 'Quota' => $this->quota, + 'Organization Provider' => $this->organizationProvider, + 'Organization Id' => $this->organizationId, ]; } } \ No newline at end of file diff --git a/lib/Service/OrganizationFolderService.php b/lib/Service/OrganizationFolderService.php index 4db0bfe..865cf5b 100644 --- a/lib/Service/OrganizationFolderService.php +++ b/lib/Service/OrganizationFolderService.php @@ -24,13 +24,21 @@ class OrganizationFolderService { ) { } - public function getAll() { + public function findAll() { $result = []; - $tags = $this->tagService->findAllIncludingGroupfolder("organization_folder"); + $groupfolders = $this->tagService->findGroupfoldersWithTagsGenerator([ + ["key" => "organization_folder"], + ], ["organization_provider", "organization_id"]); - foreach ($tags as $tag) { - $result[] = new OrganizationFolder($tag["group_folder_id"], $tag["mount_point"], $tag["quota"]); + foreach ($groupfolders as $groupfolder) { + $result[] = new OrganizationFolder( + id: $groupfolder["id"], + name: $groupfolder["mount_point"], + quota: $groupfolder["quota"], + organizationProvider: $groupfolder["organization_provider"], + organizationId: $groupfolder["organization_id"], + ); } return $result;