0
0
Fork 0
mirror of https://github.com/verdigado/organization_folders.git synced 2024-11-23 21:20:28 +01:00

use new more versatile tag query methods

This commit is contained in:
Jonathan Treffler 2024-11-01 02:52:42 +01:00
parent 82d95da322
commit 79a1c1e9f3
3 changed files with 19 additions and 5 deletions

View file

@ -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;

View file

@ -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,
];
}
}

View file

@ -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;