refactor: rename timelineQuery
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/877/head
parent
2f5e732258
commit
ba959d2c43
|
@ -39,7 +39,7 @@ class DaysController extends GenericApiController
|
||||||
public function days(): Http\Response
|
public function days(): Http\Response
|
||||||
{
|
{
|
||||||
return Util::guardEx(function () {
|
return Util::guardEx(function () {
|
||||||
$list = $this->timelineQuery->getDays(
|
$list = $this->tq->getDays(
|
||||||
$this->isRecursive(),
|
$this->isRecursive(),
|
||||||
$this->isArchive(),
|
$this->isArchive(),
|
||||||
$this->getTransformations(),
|
$this->getTransformations(),
|
||||||
|
@ -90,7 +90,7 @@ class DaysController extends GenericApiController
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run actual query
|
// Run actual query
|
||||||
$list = $this->timelineQuery->getDay(
|
$list = $this->tq->getDay(
|
||||||
$dayIds,
|
$dayIds,
|
||||||
$this->isRecursive(),
|
$this->isRecursive(),
|
||||||
$this->isArchive(),
|
$this->isArchive(),
|
||||||
|
@ -149,27 +149,27 @@ class DaysController extends GenericApiController
|
||||||
|
|
||||||
// Filter only favorites
|
// Filter only favorites
|
||||||
if ($this->request->getParam('fav')) {
|
if ($this->request->getParam('fav')) {
|
||||||
$transforms[] = [$this->timelineQuery, 'transformFavoriteFilter'];
|
$transforms[] = [$this->tq, 'transformFavoriteFilter'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter only videos
|
// Filter only videos
|
||||||
if ($this->request->getParam('vid')) {
|
if ($this->request->getParam('vid')) {
|
||||||
$transforms[] = [$this->timelineQuery, 'transformVideoFilter'];
|
$transforms[] = [$this->tq, 'transformVideoFilter'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter geological bounds
|
// Filter geological bounds
|
||||||
if ($bounds = $this->request->getParam('mapbounds')) {
|
if ($bounds = $this->request->getParam('mapbounds')) {
|
||||||
$transforms[] = [$this->timelineQuery, 'transformMapBoundsFilter', $bounds];
|
$transforms[] = [$this->tq, 'transformMapBoundsFilter', $bounds];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit number of responses for day query
|
// Limit number of responses for day query
|
||||||
if ($limit = $this->request->getParam('limit')) {
|
if ($limit = $this->request->getParam('limit')) {
|
||||||
$transforms[] = [$this->timelineQuery, 'transformLimit', (int) $limit];
|
$transforms[] = [$this->tq, 'transformLimit', (int) $limit];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add extra fields for native callers
|
// Add extra fields for native callers
|
||||||
if (Util::callerIsNative()) {
|
if (Util::callerIsNative()) {
|
||||||
$transforms[] = [$this->timelineQuery, 'transformNativeQuery'];
|
$transforms[] = [$this->tq, 'transformNativeQuery'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $transforms;
|
return $transforms;
|
||||||
|
@ -208,7 +208,7 @@ class DaysController extends GenericApiController
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\count($preloadDayIds) > 0) {
|
if (\count($preloadDayIds) > 0) {
|
||||||
$allDetails = $this->timelineQuery->getDay(
|
$allDetails = $this->tq->getDay(
|
||||||
$preloadDayIds,
|
$preloadDayIds,
|
||||||
$this->isRecursive(),
|
$this->isRecursive(),
|
||||||
$this->isArchive(),
|
$this->isArchive(),
|
||||||
|
|
|
@ -54,7 +54,7 @@ class FoldersController extends GenericApiController
|
||||||
'fileid' => $node->getId(),
|
'fileid' => $node->getId(),
|
||||||
'name' => $node->getName(),
|
'name' => $node->getName(),
|
||||||
'path' => $node->getPath(),
|
'path' => $node->getPath(),
|
||||||
'previews' => $this->timelineQuery->getRootPreviews($root),
|
'previews' => $this->tq->getRootPreviews($root),
|
||||||
];
|
];
|
||||||
}, $folders);
|
}, $folders);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ abstract class GenericApiController extends ApiController
|
||||||
protected IAppManager $appManager;
|
protected IAppManager $appManager;
|
||||||
protected IDBConnection $connection;
|
protected IDBConnection $connection;
|
||||||
protected LoggerInterface $logger;
|
protected LoggerInterface $logger;
|
||||||
protected TimelineQuery $timelineQuery;
|
protected TimelineQuery $tq;
|
||||||
protected FsManager $fs;
|
protected FsManager $fs;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -54,7 +54,7 @@ abstract class GenericApiController extends ApiController
|
||||||
IRootFolder $rootFolder,
|
IRootFolder $rootFolder,
|
||||||
IAppManager $appManager,
|
IAppManager $appManager,
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
TimelineQuery $timelineQuery,
|
TimelineQuery $tq,
|
||||||
FsManager $fs
|
FsManager $fs
|
||||||
) {
|
) {
|
||||||
parent::__construct(Application::APPNAME, $request);
|
parent::__construct(Application::APPNAME, $request);
|
||||||
|
@ -65,7 +65,7 @@ abstract class GenericApiController extends ApiController
|
||||||
$this->rootFolder = $rootFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
$this->appManager = $appManager;
|
$this->appManager = $appManager;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->timelineQuery = $timelineQuery;
|
$this->tq = $tq;
|
||||||
$this->fs = $fs;
|
$this->fs = $fs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ class ImageController extends GenericApiController
|
||||||
$file = $this->fs->getUserFile($id);
|
$file = $this->fs->getUserFile($id);
|
||||||
|
|
||||||
// Get the image info
|
// Get the image info
|
||||||
$info = $this->timelineQuery->getInfoById($id, $basic);
|
$info = $this->tq->getInfoById($id, $basic);
|
||||||
|
|
||||||
// Add fileid and etag
|
// Add fileid and etag
|
||||||
$info['fileid'] = $file->getId();
|
$info['fileid'] = $file->getId();
|
||||||
|
|
|
@ -47,11 +47,11 @@ class MapController extends GenericApiController
|
||||||
$clusterDensity = 1;
|
$clusterDensity = 1;
|
||||||
$gridLen = 180.0 / (2 ** $zoom * $clusterDensity);
|
$gridLen = 180.0 / (2 ** $zoom * $clusterDensity);
|
||||||
|
|
||||||
$clusters = $this->timelineQuery->getMapClusters($gridLen, $bounds);
|
$clusters = $this->tq->getMapClusters($gridLen, $bounds);
|
||||||
|
|
||||||
// Get previews for each cluster
|
// Get previews for each cluster
|
||||||
$clusterIds = array_map(static fn ($cluster) => (int) $cluster['id'], $clusters);
|
$clusterIds = array_map(static fn ($cluster) => (int) $cluster['id'], $clusters);
|
||||||
$previews = $this->timelineQuery->getMapClusterPreviews($clusterIds);
|
$previews = $this->tq->getMapClusterPreviews($clusterIds);
|
||||||
|
|
||||||
// Merge the responses
|
// Merge the responses
|
||||||
$fileMap = [];
|
$fileMap = [];
|
||||||
|
@ -73,7 +73,7 @@ class MapController extends GenericApiController
|
||||||
{
|
{
|
||||||
return Util::guardEx(function () {
|
return Util::guardEx(function () {
|
||||||
return new JSONResponse([
|
return new JSONResponse([
|
||||||
'pos' => $this->timelineQuery->getMapInitialPosition(),
|
'pos' => $this->tq->getMapInitialPosition(),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class PublicController extends AuthPublicShareController
|
||||||
protected IRootFolder $rootFolder;
|
protected IRootFolder $rootFolder;
|
||||||
protected IShareManager $shareManager;
|
protected IShareManager $shareManager;
|
||||||
protected IConfig $config;
|
protected IConfig $config;
|
||||||
protected TimelineQuery $timelineQuery;
|
protected TimelineQuery $tq;
|
||||||
|
|
||||||
protected IShare $share;
|
protected IShare $share;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class PublicController extends AuthPublicShareController
|
||||||
IRootFolder $rootFolder,
|
IRootFolder $rootFolder,
|
||||||
IShareManager $shareManager,
|
IShareManager $shareManager,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
TimelineQuery $timelineQuery
|
TimelineQuery $tq
|
||||||
) {
|
) {
|
||||||
parent::__construct($AppName, $request, $session, $urlGenerator);
|
parent::__construct($AppName, $request, $session, $urlGenerator);
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
@ -54,7 +54,7 @@ class PublicController extends AuthPublicShareController
|
||||||
$this->rootFolder = $rootFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
$this->shareManager = $shareManager;
|
$this->shareManager = $shareManager;
|
||||||
$this->config = $config;
|
$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
|
private function getSingleItemInitialState(\OCP\Files\File $file): array
|
||||||
{
|
{
|
||||||
$data = $this->timelineQuery->getSingleItem($file->getId());
|
$data = $this->tq->getSingleItem($file->getId());
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ class VideoController extends GenericApiController
|
||||||
private function getClosestLiveVideo(File $file): ?File
|
private function getClosestLiveVideo(File $file): ?File
|
||||||
{
|
{
|
||||||
// Get stored video file (Apple MOV)
|
// 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
|
// Get file paths for all live photos
|
||||||
$liveFiles = array_map(fn ($r) => $this->rootFolder->getById((int) $r['fileid']), $liveRecords);
|
$liveFiles = array_map(fn ($r) => $this->rootFolder->getById((int) $r['fileid']), $liveRecords);
|
||||||
|
|
Loading…
Reference in New Issue