record collection getApiOutput method
This commit is contained in:
@@ -35,6 +35,9 @@ use Espo\Tools\ActionHistory\Service as Service;
|
||||
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
class LastViewed
|
||||
{
|
||||
public function __construct(private SearchParamsFetcher $searchParamsFetcher, private Service $service)
|
||||
@@ -49,9 +52,6 @@ class LastViewed
|
||||
|
||||
$result = $this->service->getLastViewed($maxSize, $offset);
|
||||
|
||||
return (object) [
|
||||
'total' => $result->getTotal(),
|
||||
'list' => $result->getValueMapList(),
|
||||
];
|
||||
return $result->toApiOutput();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,10 +83,7 @@ class Notification extends RecordBase
|
||||
|
||||
$recordCollection = $this->getNotificationService()->get($userId, $searchParams);
|
||||
|
||||
return (object) [
|
||||
'total' => $recordCollection->getTotal(),
|
||||
'list' => $recordCollection->getValueMapList(),
|
||||
];
|
||||
return $recordCollection->toApiOutput();
|
||||
}
|
||||
|
||||
public function getActionNotReadCount(): int
|
||||
|
||||
@@ -79,12 +79,12 @@ class Stream
|
||||
|
||||
$reactionsCheckDate = DateTime::createNow();
|
||||
|
||||
return (object) [
|
||||
'total' => $collection->getTotal(),
|
||||
'list' => $collection->getValueMapList(),
|
||||
'reactionsCheckDate' => $reactionsCheckDate->toString(),
|
||||
'updatedReactions' => $this->getReactionUpdates($request, $id),
|
||||
];
|
||||
$output = $collection->toApiOutput();
|
||||
|
||||
$output->reactionsCheckDate = $reactionsCheckDate->toString();
|
||||
$output->updatedReactions = $this->getReactionUpdates($request, $id);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
if ($id === null) {
|
||||
@@ -94,11 +94,11 @@ class Stream
|
||||
$collection = $this->service->find($scope, $id, $searchParams);
|
||||
$pinnedCollection = $this->service->getPinned($scope, $id);
|
||||
|
||||
return (object) [
|
||||
'total' => $collection->getTotal(),
|
||||
'list' => $collection->getValueMapList(),
|
||||
'pinnedList' => $pinnedCollection->getValueMapList(),
|
||||
];
|
||||
$output = $collection->toApiOutput();
|
||||
|
||||
$output->pinnedList = $pinnedCollection->getValueMapList();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,10 +126,7 @@ class Stream
|
||||
$this->userRecordService->find($id, $searchParams) :
|
||||
$this->service->find($scope, $id ?? '', $searchParams);
|
||||
|
||||
return (object) [
|
||||
'total' => $result->getTotal(),
|
||||
'list' => $result->getValueMapList(),
|
||||
];
|
||||
return $result->toApiOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,10 +147,7 @@ class Stream
|
||||
|
||||
$result = $this->service->findUpdates($scope, $id, $searchParams);
|
||||
|
||||
return (object) [
|
||||
'total' => $result->getTotal(),
|
||||
'list' => $result->getValueMapList(),
|
||||
];
|
||||
return $result->toApiOutput();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user