pull/175/head
Varun Patil 2022-11-06 20:49:33 -08:00
parent 6f3cb99ddb
commit 5ce70faee1
4 changed files with 16 additions and 14 deletions

View File

@ -33,8 +33,8 @@ class DaysController extends ApiBase
/** /**
* @NoAdminRequired * @NoAdminRequired
* @NoCSRFRequired
* *
* @NoCSRFRequired
* *
* @PublicPage * @PublicPage
*/ */

View File

@ -2,21 +2,14 @@
namespace OCA\Memories\Controller; namespace OCA\Memories\Controller;
use OCA\Memories\Db\TimelineQuery;
use OCP\Files\FileInfo; use OCP\Files\FileInfo;
use OCP\Files\Folder; use OCP\Files\Folder;
use OCA\Memories\Db\TimelineQuery;
trait FoldersTrait { trait FoldersTrait
{
protected TimelineQuery $timelineQuery; protected TimelineQuery $timelineQuery;
private function getFolderPreviews(Folder &$parent, FileInfo &$fileInfo) {
$folder = $parent->getById($fileInfo->getId());
if (count($folder) === 0) {
return [];
}
return $this->timelineQuery->getFolderPreviews($folder[0]);
}
/** /**
* Get subfolders entry for days response. * Get subfolders entry for days response.
*/ */
@ -52,4 +45,14 @@ trait FoldersTrait {
}, $folders, []), }, $folders, []),
]; ];
} }
private function getFolderPreviews(Folder &$parent, FileInfo &$fileInfo)
{
$folder = $parent->getById($fileInfo->getId());
if (0 === \count($folder)) {
return [];
}
return $this->timelineQuery->getFolderPreviews($folder[0]);
}
} }

View File

@ -13,8 +13,8 @@ class TimelineQuery
use TimelineQueryDays; use TimelineQueryDays;
use TimelineQueryFaces; use TimelineQueryFaces;
use TimelineQueryFilters; use TimelineQueryFilters;
use TimelineQueryTags;
use TimelineQueryFolders; use TimelineQueryFolders;
use TimelineQueryTags;
protected IDBConnection $connection; protected IDBConnection $connection;

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace OCA\Memories\Db; namespace OCA\Memories\Db;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Folder; use OCP\Files\Folder;
use OCP\IDBConnection; use OCP\IDBConnection;