Skip to content

Commit

Permalink
refactor: rename timelineQuery
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Oct 14, 2023
1 parent 2f5e732 commit ba959d2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions lib/Controller/DaysController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -90,7 +90,7 @@ public function day(string $id): Http\Response
}

// Run actual query
$list = $this->timelineQuery->getDay(
$list = $this->tq->getDay(
$dayIds,
$this->isRecursive(),
$this->isArchive(),
Expand Down Expand Up @@ -149,27 +149,27 @@ private function getTransformations()

// 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;
Expand Down Expand Up @@ -208,7 +208,7 @@ private function preloadDays(array &$days)
}

if (\count($preloadDayIds) > 0) {
$allDetails = $this->timelineQuery->getDay(
$allDetails = $this->tq->getDay(
$preloadDayIds,
$this->isRecursive(),
$this->isArchive(),
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/FoldersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function sub(string $folder): Http\Response
'fileid' => $node->getId(),
'name' => $node->getName(),
'path' => $node->getPath(),
'previews' => $this->timelineQuery->getRootPreviews($root),
'previews' => $this->tq->getRootPreviews($root),
];
}, $folders);

Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/GenericApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -54,7 +54,7 @@ public function __construct(
IRootFolder $rootFolder,
IAppManager $appManager,
LoggerInterface $logger,
TimelineQuery $timelineQuery,
TimelineQuery $tq,
FsManager $fs
) {
parent::__construct(Application::APPNAME, $request);
Expand All @@ -65,7 +65,7 @@ public function __construct(
$this->rootFolder = $rootFolder;
$this->appManager = $appManager;
$this->logger = $logger;
$this->timelineQuery = $timelineQuery;
$this->tq = $tq;
$this->fs = $fs;
}
}
2 changes: 1 addition & 1 deletion lib/Controller/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function info(
$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();
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/MapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public function clusters(string $bounds, string $zoom): Http\Response
$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 = [];
Expand All @@ -73,7 +73,7 @@ public function init(): Http\Response
{
return Util::guardEx(function () {
return new JSONResponse([
'pos' => $this->timelineQuery->getMapInitialPosition(),
'pos' => $this->tq->getMapInitialPosition(),
]);
});
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Controller/PublicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -45,7 +45,7 @@ public function __construct(
IRootFolder $rootFolder,
IShareManager $shareManager,
IConfig $config,
TimelineQuery $timelineQuery
TimelineQuery $tq
) {
parent::__construct($AppName, $request, $session, $urlGenerator);
$this->eventDispatcher = $eventDispatcher;
Expand All @@ -54,7 +54,7 @@ public function __construct(
$this->rootFolder = $rootFolder;
$this->shareManager = $shareManager;
$this->config = $config;
$this->timelineQuery = $timelineQuery;
$this->tq = $tq;
}

/**
Expand Down Expand Up @@ -230,7 +230,7 @@ protected function redirectIfOwned(IShare $share)
*/
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();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/VideoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ private static function postFileInternal(string $client, $blob)
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);
Expand Down

0 comments on commit ba959d2

Please sign in to comment.