From c45513a4125661d82039708f5e8f73b795166aba Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Tue, 24 Mar 2026 19:12:48 -0400 Subject: [PATCH] refactor: improvemets Signed-off-by: Sebastian Krupinski --- lib/Providers/Personal/PersonalService.php | 28 +++++----------------- lib/Store/MetaStore.php | 12 +++++----- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/lib/Providers/Personal/PersonalService.php b/lib/Providers/Personal/PersonalService.php index f4bbf0d..f177f41 100644 --- a/lib/Providers/Personal/PersonalService.php +++ b/lib/Providers/Personal/PersonalService.php @@ -720,34 +720,21 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI // Node operations - /** - * @inheritdoc - */ - public function nodeList(string|int|null $location = null, bool $recursive = false, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null): array { - // null location is root - if ($location === null) { - $location = self::ROOT_ID; + public function nodeList(string|int|null $collection = null, bool $recursive = false, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array { + if ($collection === null) { + $collection = self::ROOT_ID; } - return $this->metaStore->nodeList($this->serviceTenantId, $this->serviceUserId, $location, $recursive, $filter, $sort, $range); + return $this->metaStore->nodeList($this->serviceTenantId, $this->serviceUserId, $collection, $recursive, $filter, $sort, $range, $properties); } - /** - * @inheritdoc - */ public function nodeListFilter(): IFilter { return new Filter($this->serviceAbilities[self::CAPABILITY_COLLECTION_LIST_FILTER] ?? []); } - /** - * @inheritdoc - */ public function nodeListSort(): ISort { return new Sort($this->serviceAbilities[self::CAPABILITY_COLLECTION_LIST_SORT] ?? []); } - /** - * @inheritdoc - */ public function nodeListRange(RangeType $type): IRange { if ($type !== RangeType::TALLY) { throw new InvalidParameterException("Invalid: Node range of type '{$type->value}' is not supported"); @@ -755,11 +742,8 @@ class PersonalService implements ServiceBaseInterface, ServiceCollectionMutableI return new RangeTally(); } - /** - * @inheritdoc - */ - public function nodeDelta(string|int|null $location, string $signature, bool $recursive = false, string $detail = 'ids'): array { - return $this->metaStore->nodeDelta($this->serviceTenantId, $this->serviceUserId, $location, $signature, $recursive, $detail); + public function nodeDelta(string|int|null $collection, string $signature, string $detail = 'ids'): Delta { + return new Delta(); } /** diff --git a/lib/Store/MetaStore.php b/lib/Store/MetaStore.php index 4beacad..802c037 100644 --- a/lib/Store/MetaStore.php +++ b/lib/Store/MetaStore.php @@ -545,14 +545,14 @@ class MetaStore { // For non-recursive, filter by parent if (!$recursive) { - $query['pid'] = $location; + $query['cid'] = $location; } elseif ($location !== null) { // For recursive with specific location, we need to get all descendants // This requires getting all collections first and building a list of IDs $allCollectionIds = $this->getDescendantCollectionIds($tenantId, $userId, $location); $allCollectionIds[] = $location; $query['$or'] = [ - ['pid' => ['$in' => $allCollectionIds]], + ['cid' => ['$in' => $allCollectionIds]], ['nid' => ['$in' => $allCollectionIds]], ]; } @@ -578,13 +578,13 @@ class MetaStore { $cursor = $this->_store->selectCollection($this->_NodeTable)->find($query, $options); $list = []; foreach ($cursor as $entry) { - $nodeType = $entry['type'] ?? NodeType::Entity->value; + $nodeType = $entry['type']; if ($nodeType === NodeType::Collection->value) { - $node = (new NodeCollection())->fromStore($entry); - } else { + $node = (new CollectionResource())->fromStore($entry); + } else if ($nodeType === NodeType::Entity->value) { $node = (new EntityResource())->fromStore($entry); } - $list[$node->id()] = $node; + $list[$node->identifier()] = $node; } return $list; }