feat: implement ServiceNodeListInterface
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
+23
-23
@@ -31,29 +31,28 @@ class MetaStore {
|
||||
|
||||
protected array $_CollectionFilterAttributeMap = [
|
||||
'id' => 'nid',
|
||||
'label' => 'name',
|
||||
'label' => 'properties.label',
|
||||
'parent' => 'pid',
|
||||
];
|
||||
|
||||
protected array $_EntityFilterAttributeMap = [
|
||||
'id' => 'nid',
|
||||
'label' => 'name',
|
||||
'label' => 'properties.label',
|
||||
];
|
||||
|
||||
protected array $_NodeFilterAttributeMap = [
|
||||
'id' => 'nid',
|
||||
'label' => 'name',
|
||||
'label' => 'properties.label',
|
||||
'type' => 'type',
|
||||
'parent' => 'pid',
|
||||
];
|
||||
|
||||
protected array $_SortAttributeMap = [
|
||||
'label' => 'name',
|
||||
'label' => 'properties.label',
|
||||
'type' => 'type',
|
||||
'size' => 'size',
|
||||
'type' => 'type',
|
||||
'createdOn' => 'createdOn',
|
||||
'modifiedOn' => 'modifiedOn',
|
||||
'size' => 'properties.size',
|
||||
'createdOn' => 'created',
|
||||
'modifiedOn' => 'modified',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
@@ -151,9 +150,9 @@ class MetaStore {
|
||||
$sortConditions = $this->constructSort($this->_SortAttributeMap, $sort);
|
||||
$options['sort'] = $sortConditions;
|
||||
} else {
|
||||
$options['sort'] = ['name' => 1];
|
||||
$options['sort'] = ['properties.label' => 1];
|
||||
}
|
||||
|
||||
|
||||
$cursor = $this->_store->selectCollection($this->_NodeTable)->find($query, $options);
|
||||
$list = [];
|
||||
foreach ($cursor as $entry) {
|
||||
@@ -358,14 +357,14 @@ class MetaStore {
|
||||
$sortConditions = $this->constructSort($this->_SortAttributeMap, $sort);
|
||||
$options['sort'] = $sortConditions;
|
||||
} else {
|
||||
$options['sort'] = ['name' => 1];
|
||||
$options['sort'] = ['properties.label' => 1];
|
||||
}
|
||||
|
||||
|
||||
if ($range !== null && $range->type() === RangeType::TALLY && $range instanceof IRangeTally) {
|
||||
$options['skip'] = $range->getPosition();
|
||||
$options['limit'] = $range->getTally();
|
||||
}
|
||||
|
||||
|
||||
$cursor = $this->_store->selectCollection($this->_NodeTable)->find($query, $options);
|
||||
$list = [];
|
||||
foreach ($cursor as $entry) {
|
||||
@@ -562,11 +561,12 @@ class MetaStore {
|
||||
$options = [];
|
||||
if ($sort !== null) {
|
||||
$sortConditions = $this->constructSort($this->_SortAttributeMap, $sort);
|
||||
$options['sort'] = $sortConditions;
|
||||
// folders must always sort before files, regardless of the caller's chosen sort field
|
||||
$options['sort'] = ['type' => 1] + $sortConditions;
|
||||
} else {
|
||||
$options['sort'] = ['type' => -1, 'name' => 1]; // folders first
|
||||
$options['sort'] = ['type' => 1, 'properties.label' => 1]; // folders first, then alphabetical
|
||||
}
|
||||
|
||||
|
||||
if ($range !== null && $range->type() === RangeType::TALLY && $range instanceof IRangeTally) {
|
||||
$options['skip'] = $range->getPosition();
|
||||
$options['limit'] = $range->getTally();
|
||||
@@ -586,6 +586,13 @@ class MetaStore {
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Node delta (changes since signature, optionally recursive)
|
||||
*/
|
||||
public function nodeDelta(string $tenantId, string $userId, string|int|null $location, string $signature, bool $recursive = false, string $detail = 'ids'): array {
|
||||
return $this->internalDelta($tenantId, $userId, $location, $signature, $recursive, $detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all descendant collection IDs (helper for recursive operations)
|
||||
*/
|
||||
@@ -607,13 +614,6 @@ class MetaStore {
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Node delta (changes since signature, optionally recursive)
|
||||
*/
|
||||
public function nodeDelta(string $tenantId, string $userId, string|int|null $location, string $signature, bool $recursive = false, string $detail = 'ids'): array {
|
||||
return $this->internalDelta($tenantId, $userId, $location, $signature, $recursive, $detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal delta implementation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user