refactor: rename timelineQuery

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/877/head
Varun Patil 2023-10-13 23:51:12 -07:00
parent 2f5e732258
commit ba959d2c43
7 changed files with 21 additions and 21 deletions

View File

@ -39,7 +39,7 @@ class DaysController extends GenericApiController
public function days(): Http\Response
{
return Util::guardEx(function () {
$list = $this->timelineQuery->getDays(
$list = $this->tq->getDays(
$this->isRecursive(),
$this->isArchive(),
$this->getTransformations(),
@ -90,7 +90,7 @@ class DaysController extends GenericApiController
}
// Run actual query
$list = $this->timelineQuery->getDay(
$list = $this->tq->getDay(
$dayIds,
$this->isRecursive(),
$this->isArchive(),
@ -149,27 +149,27 @@ class DaysController extends GenericApiController
// Filter only favorites
if ($this->request->getParam('fav')) {
$transforms[] = [$this->timelineQuery, 'transformFavoriteFilter'];
$transforms[] = [$this->tq, 'transformFavoriteFilter'];
}
// Filter only videos
if ($this->request->getParam('vid')) {
$transforms[] = [$this->timelineQuery, 'transformVideoFilter'];
$transforms[] = [$this->tq, 'transformVideoFilter'];
}
// Filter geological bounds
if ($bounds = $this->request->getParam('mapbounds')) {
$transforms[] = [$this->timelineQuery, 'transformMapBoundsFilter', $bounds];
$transforms[] = [$this->tq, 'transformMapBoundsFilter', $bounds];
}
// Limit number of responses for day query
if ($limit = $this->request->getParam('limit')) {
$transforms[] = [$this->timelineQuery, 'transformLimit', (int) $limit];
$transforms[] = [$this->tq, 'transformLimit', (int) $limit];
}
// Add extra fields for native callers
if (Util::callerIsNative()) {
$transforms[] = [$this->timelineQuery, 'transformNativeQuery'];
$transforms[] = [$this->tq, 'transformNativeQuery'];
}
return $transforms;
@ -208,7 +208,7 @@ class DaysController extends GenericApiController
}
if (\count($preloadDayIds) > 0) {
$allDetails = $this->timelineQuery->getDay(
$allDetails = $this->tq->getDay(
$preloadDayIds,
$this->isRecursive(),
$this->isArchive(),

View File

@ -54,7 +54,7 @@ class FoldersController extends GenericApiController
'fileid' => $node->getId(),
'name' => $node->getName(),
'path' => $node->getPath(),
'previews' => $this->timelineQuery->getRootPreviews($root),
'previews' => $this->tq->getRootPreviews($root),
];
}, $folders);

View File

@ -43,7 +43,7 @@ abstract class GenericApiController extends ApiController
protected IAppManager $appManager;
protected IDBConnection $connection;
protected LoggerInterface $logger;
protected TimelineQuery $timelineQuery;
protected TimelineQuery $tq;
protected FsManager $fs;
public function __construct(
@ -54,7 +54,7 @@ abstract class GenericApiController extends ApiController
IRootFolder $rootFolder,
IAppManager $appManager,
LoggerInterface $logger,
TimelineQuery $timelineQuery,
TimelineQuery $tq,
FsManager $fs
) {
parent::__construct(Application::APPNAME, $request);
@ -65,7 +65,7 @@ abstract class GenericApiController extends ApiController
$this->rootFolder = $rootFolder;
$this->appManager = $appManager;
$this->logger = $logger;
$this->timelineQuery = $timelineQuery;
$this->tq = $tq;
$this->fs = $fs;
}
}

View File

@ -187,7 +187,7 @@ class ImageController extends GenericApiController
$file = $this->fs->getUserFile($id);
// Get the image info
$info = $this->timelineQuery->getInfoById($id, $basic);
$info = $this->tq->getInfoById($id, $basic);
// Add fileid and etag
$info['fileid'] = $file->getId();

View File

@ -47,11 +47,11 @@ class MapController extends GenericApiController
$clusterDensity = 1;
$gridLen = 180.0 / (2 ** $zoom * $clusterDensity);
$clusters = $this->timelineQuery->getMapClusters($gridLen, $bounds);
$clusters = $this->tq->getMapClusters($gridLen, $bounds);
// Get previews for each cluster
$clusterIds = array_map(static fn ($cluster) => (int) $cluster['id'], $clusters);
$previews = $this->timelineQuery->getMapClusterPreviews($clusterIds);
$previews = $this->tq->getMapClusterPreviews($clusterIds);
// Merge the responses
$fileMap = [];
@ -73,7 +73,7 @@ class MapController extends GenericApiController
{
return Util::guardEx(function () {
return new JSONResponse([
'pos' => $this->timelineQuery->getMapInitialPosition(),
'pos' => $this->tq->getMapInitialPosition(),
]);
});
}

View File

@ -30,7 +30,7 @@ class PublicController extends AuthPublicShareController
protected IRootFolder $rootFolder;
protected IShareManager $shareManager;
protected IConfig $config;
protected TimelineQuery $timelineQuery;
protected TimelineQuery $tq;
protected IShare $share;
@ -45,7 +45,7 @@ class PublicController extends AuthPublicShareController
IRootFolder $rootFolder,
IShareManager $shareManager,
IConfig $config,
TimelineQuery $timelineQuery
TimelineQuery $tq
) {
parent::__construct($AppName, $request, $session, $urlGenerator);
$this->eventDispatcher = $eventDispatcher;
@ -54,7 +54,7 @@ class PublicController extends AuthPublicShareController
$this->rootFolder = $rootFolder;
$this->shareManager = $shareManager;
$this->config = $config;
$this->timelineQuery = $timelineQuery;
$this->tq = $tq;
}
/**
@ -230,7 +230,7 @@ class PublicController extends AuthPublicShareController
*/
private function getSingleItemInitialState(\OCP\Files\File $file): array
{
$data = $this->timelineQuery->getSingleItem($file->getId());
$data = $this->tq->getSingleItem($file->getId());
if (null === $data) {
throw new NotFoundException();
}

View File

@ -356,7 +356,7 @@ class VideoController extends GenericApiController
private function getClosestLiveVideo(File $file): ?File
{
// Get stored video file (Apple MOV)
$liveRecords = $this->timelineQuery->getLivePhotos($file->getId());
$liveRecords = $this->tq->getLivePhotos($file->getId());
// Get file paths for all live photos
$liveFiles = array_map(fn ($r) => $this->rootFolder->getById((int) $r['fileid']), $liveRecords);