pinned notes

This commit is contained in:
Yuri Kuznetsov
2024-05-07 15:46:51 +03:00
parent 692e0b43e3
commit 3fc4b487b3
27 changed files with 729 additions and 78 deletions
+18 -9
View File
@@ -68,19 +68,28 @@ class Stream
throw new BadRequest();
}
if ($id === null && $scope !== UserEntity::ENTITY_TYPE) {
throw new BadRequest("No ID.");
}
$searchParams = $this->fetchSearchParams($request);
$result = $scope === UserEntity::ENTITY_TYPE ?
$this->userRecordService->find($id, $searchParams) :
$this->service->find($scope, $id ?? '', $searchParams);
if ($scope === UserEntity::ENTITY_TYPE) {
$collection = $this->userRecordService->find($id, $searchParams);
return (object) [
'total' => $collection->getTotal(),
'list' => $collection->getValueMapList(),
];
}
if ($id === null) {
throw new BadRequest();
}
$collection = $this->service->find($scope, $id, $searchParams);
$pinnedCollection = $this->service->getPinned($scope, $id);
return (object) [
'total' => $result->getTotal(),
'list' => $result->getValueMapList(),
'total' => $collection->getTotal(),
'list' => $collection->getValueMapList(),
'pinnedList' => $pinnedCollection->getValueMapList(),
];
}