From dd3590a12412ff58b5cfab652d670155eafc2a5a Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Fri, 9 Aug 2024 11:11:02 +0200 Subject: [PATCH 01/13] Pagination details in local controller --- lib/Controller/SearchController.php | 20 +++++++++++++++----- lib/Db/PublicationMapper.php | 25 +++++++++++++++++++++++++ lib/Service/SearchService.php | 7 +++++-- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/lib/Controller/SearchController.php b/lib/Controller/SearchController.php index 7e4fcb90..7eca2aa4 100644 --- a/lib/Controller/SearchController.php +++ b/lib/Controller/SearchController.php @@ -101,8 +101,8 @@ public function index(SearchService $searchService): JSONResponse $searchParams = $searchService->createMySQLSearchParams(filters: $filters); $searchConditions = $searchService->createMySQLSearchConditions(filters: $filters, fieldsToSearch: $fieldsToSearch); - $limit = null; - $offset = null; + $limit = 30; + $offset = 0; if(isset($filters['_limit']) === true) { $limit = $filters['_limit']; @@ -114,9 +114,19 @@ public function index(SearchService $searchService): JSONResponse $filters = $searchService->unsetSpecialQueryParams(filters: $filters); - - - return new JSONResponse(['results' => $this->publicationMapper->findAll(limit: $limit, offset: $offset, filters: $filters, searchConditions: $searchConditions, searchParams: $searchParams)]); + $total = $this->publicationMapper->count($filters); + $results = $this->publicationMapper->findAll(limit: $limit, offset: $offset, filters: $filters, searchConditions: $searchConditions, searchParams: $searchParams); + $pages = (int) ceil($total / $limit); + + return new JSONResponse([ + 'results' => $results, + 'facets' => [], + 'count' => count($results), + 'limit' => $limit, + 'page' => isset($filters['_page']) === true ? $filters['_page'] : 1, + 'pages' => $pages === 0 ? 1 : $pages, + 'total' => $total + ]); } //@TODO: find a better way to get query params. This fixes it for now. diff --git a/lib/Db/PublicationMapper.php b/lib/Db/PublicationMapper.php index c834dfbf..02a2915c 100644 --- a/lib/Db/PublicationMapper.php +++ b/lib/Db/PublicationMapper.php @@ -28,6 +28,31 @@ public function find(int $id): Publication return $this->findEntity(query: $qb); } + public function count(?array $filters = [], ?array $searchConditions = [], ?array $searchParams = []): int + { + $qb = $this->db->getQueryBuilder(); + + $qb->selectAlias($qb->createFunction('COUNT(*)'), 'count') + ->from('publications'); + + foreach($filters as $filter => $value) { + $qb->andWhere($qb->expr()->eq($filter, $qb->createNamedParameter($value))); + } + + if (!empty($searchConditions)) { + $qb->andWhere('(' . implode(' OR ', $searchConditions) . ')'); + foreach ($searchParams as $param => $value) { + $qb->setParameter($param, $value); + } + } + + $cursor = $qb->execute(); + $row = $cursor->fetch(); + $cursor->closeCursor(); + + return $row['count']; + } + public function findAll(?int $limit = null, ?int $offset = null, ?array $filters = [], ?array $searchConditions = [], ?array $searchParams = []): array { $qb = $this->db->getQueryBuilder(); diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 57d495f9..821b4711 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -96,13 +96,14 @@ public function search(array $parameters, array $elasticConfig, array $dbConfig, // $directory = $this->objectService->findObjects(filters: ['_schema' => 'directory'], config: $dbConfig); if(count($directory) === 0) { + $pages = (int) ceil($totalResults / $limit); return [ 'results' => $localResults['results'], 'facets' => $localResults['facets'], 'count' => count($localResults['results']), 'limit' => $limit, 'page' => $page, - 'pages' => ceil($totalResults / $limit), + 'pages' => $pages === 0 ? 1 : $pages, 'total' => $totalResults ]; } @@ -155,13 +156,15 @@ public function search(array $parameters, array $elasticConfig, array $dbConfig, } } + $pages = (int) ceil($totalResults / $limit); + return [ 'results' => $results, 'facets' => $aggregations, 'count' => count($results), 'limit' => $limit, 'page' => $page, - 'pages' => ceil($totalResults / $limit), + 'pages' => $pages === 0 ? 1 : $pages, 'total' => $totalResults ]; } From e2a8ca16bda4da7be2b20aec4c6b14e30d67e224 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Fri, 9 Aug 2024 11:42:50 +0200 Subject: [PATCH 02/13] Complex filters on local db --- lib/Db/PublicationMapper.php | 54 +++++++++++++++++++++++++++++++---- lib/Service/SearchService.php | 1 + 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/lib/Db/PublicationMapper.php b/lib/Db/PublicationMapper.php index 02a2915c..1ff1b09a 100644 --- a/lib/Db/PublicationMapper.php +++ b/lib/Db/PublicationMapper.php @@ -28,16 +28,60 @@ public function find(int $id): Publication return $this->findEntity(query: $qb); } + private function parseComplexFilter(IQueryBuilder $queryBuilder, array $filter, string $name): IQueryBuilder + { + foreach($filter as $key => $value) { + switch($key) { + case '>=': + case 'after': + $queryBuilder->andWhere($queryBuilder->expr()->gte($name, $queryBuilder->createNamedParameter($value))); + break; + case '>': + case 'strictly_after': + $queryBuilder->andWhere($queryBuilder->expr()->gt($name, $queryBuilder->createNamedParameter($value))); + break; + case '<=': + case 'before': + $queryBuilder->andWhere($queryBuilder->expr()->lte($name, $queryBuilder->createNamedParameter($value))); + break; + case '<': + case 'strictly_before': + $queryBuilder->andWhere($queryBuilder->expr()->lt($name, $queryBuilder->createNamedParameter($value))); + break; + default: + $queryBuilder->andWhere($queryBuilder->expr()->eq($name, $queryBuilder->createNamedParameter($filter))); + } + } + + return $queryBuilder; + } + + private function addFilters(IQueryBuilder $queryBuilder, array $filters): IQueryBuilder + { + foreach($filters as $key => $filter) { + if(is_array($filter) === false) { + $queryBuilder->andWhere($queryBuilder->expr()->eq($filter, $queryBuilder->createNamedParameter($filter))); + continue; + } + + $queryBuilder = $this->parseComplexFilter(queryBuilder: $queryBuilder, filter: $filter, name: $key); + } + + return $queryBuilder; + } + public function count(?array $filters = [], ?array $searchConditions = [], ?array $searchParams = []): int { + + $qb = $this->db->getQueryBuilder(); $qb->selectAlias($qb->createFunction('COUNT(*)'), 'count') ->from('publications'); - foreach($filters as $filter => $value) { - $qb->andWhere($qb->expr()->eq($filter, $qb->createNamedParameter($value))); - } + + $qb = $this->addFilters(queryBuilder: $qb, filters: $filters); + if (!empty($searchConditions)) { $qb->andWhere('(' . implode(' OR ', $searchConditions) . ')'); @@ -62,9 +106,7 @@ public function findAll(?int $limit = null, ?int $offset = null, ?array $filters ->setMaxResults($limit) ->setFirstResult($offset); - foreach($filters as $filter => $value) { - $qb->andWhere($qb->expr()->eq($filter, $qb->createNamedParameter($value))); - } + $qb = $this->addFilters(queryBuilder: $qb, filters: $filters); if (!empty($searchConditions)) { $qb->andWhere('(' . implode(' OR ', $searchConditions) . ')'); diff --git a/lib/Service/SearchService.php b/lib/Service/SearchService.php index 821b4711..539ed98b 100644 --- a/lib/Service/SearchService.php +++ b/lib/Service/SearchService.php @@ -74,6 +74,7 @@ public function sortResultArray(array $a, array $b): int return $a['_score'] <=> $b['_score']; } + /** * */ From 9057d71af6b5547b9b45740b6413b11a678a0639 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 9 Aug 2024 11:59:56 +0200 Subject: [PATCH 03/13] Show 404 when no object is found on GET item api-calls --- lib/Controller/AttachmentsController.php | 7 ++++++- lib/Controller/CatalogiController.php | 7 ++++++- lib/Controller/DirectoryController.php | 7 ++++++- lib/Controller/MetaDataController.php | 7 ++++++- lib/Controller/OrganisationsController.php | 7 ++++++- lib/Controller/ThemesController.php | 7 ++++++- 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/Controller/AttachmentsController.php b/lib/Controller/AttachmentsController.php index be2e3d88..67bbcb21 100644 --- a/lib/Controller/AttachmentsController.php +++ b/lib/Controller/AttachmentsController.php @@ -9,6 +9,7 @@ use OCA\OpenCatalogi\Service\FileService; use OCA\OpenCatalogi\Service\ObjectService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -131,7 +132,11 @@ public function show(string|int $id, ObjectService $objectService): JSONResponse if ($this->config->hasKey(app: $this->appName, key: 'mongoStorage') === false || $this->config->getValueString(app: $this->appName, key: 'mongoStorage') !== '1' ) { - return new JSONResponse($this->attachmentMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->attachmentMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); $dbConfig['headers']['api-key'] = $this->config->getValueString(app: $this->appName, key: 'mongodbKey'); diff --git a/lib/Controller/CatalogiController.php b/lib/Controller/CatalogiController.php index e964309a..83f26a89 100644 --- a/lib/Controller/CatalogiController.php +++ b/lib/Controller/CatalogiController.php @@ -7,6 +7,7 @@ use OCA\OpenCatalogi\Service\ObjectService; use OCA\OpenCatalogi\Service\SearchService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -81,7 +82,11 @@ public function show(string|int $id, ObjectService $objectService): JSONResponse if($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->catalogMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->catalogMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } try { diff --git a/lib/Controller/DirectoryController.php b/lib/Controller/DirectoryController.php index b6af3038..53f32965 100644 --- a/lib/Controller/DirectoryController.php +++ b/lib/Controller/DirectoryController.php @@ -7,6 +7,7 @@ use OCA\OpenCatalogi\Service\ObjectService; use OCA\OpenCatalogi\Service\SearchService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -115,7 +116,11 @@ public function show(string|int $id, ObjectService $objectService, DirectoryServ if($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->listingMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->listingMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); $dbConfig['headers']['api-key'] = $this->config->getValueString(app: $this->appName, key: 'mongodbKey'); diff --git a/lib/Controller/MetaDataController.php b/lib/Controller/MetaDataController.php index ace7db19..282ac304 100644 --- a/lib/Controller/MetaDataController.php +++ b/lib/Controller/MetaDataController.php @@ -6,6 +6,7 @@ use OCA\OpenCatalogi\Service\ObjectService; use OCA\OpenCatalogi\Service\SearchService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -84,7 +85,11 @@ public function show(string|int $id, ObjectService $objectService): JSONResponse if($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->metaDataMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->metaDataMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); $dbConfig['headers']['api-key'] = $this->config->getValueString(app: $this->appName, key: 'mongodbKey'); diff --git a/lib/Controller/OrganisationsController.php b/lib/Controller/OrganisationsController.php index 04cbbaf8..5039a395 100644 --- a/lib/Controller/OrganisationsController.php +++ b/lib/Controller/OrganisationsController.php @@ -6,6 +6,7 @@ use OCA\OpenCatalogi\Service\ObjectService; use OCP\AppFramework\Controller; use OCA\OpenCatalogi\Service\SearchService; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -93,7 +94,11 @@ public function show(string $id, ObjectService $objectService): JSONResponse if($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->organisationMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->organisationMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } try { diff --git a/lib/Controller/ThemesController.php b/lib/Controller/ThemesController.php index 308c92c6..16454ac4 100644 --- a/lib/Controller/ThemesController.php +++ b/lib/Controller/ThemesController.php @@ -6,6 +6,7 @@ use OCA\OpenCatalogi\Service\ObjectService; use OCA\OpenCatalogi\Service\SearchService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -107,7 +108,11 @@ public function show(string $id, ObjectService $objectService): JSONResponse if($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->themeMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->themeMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } try { From f7047a7eba540942b7b0e31c4f5d0728a4cf57f0 Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 12:20:58 +0200 Subject: [PATCH 04/13] Theme to thema translate fix --- src/views/themes/ThemeList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/themes/ThemeList.vue b/src/views/themes/ThemeList.vue index c49c0a8f..71e0611d 100644 --- a/src/views/themes/ThemeList.vue +++ b/src/views/themes/ThemeList.vue @@ -33,7 +33,7 @@ import { navigationStore, themeStore } from '../../store/store.js' - Theme toevoegen + Thema toevoegen From 0ad37dea709516d03f145fddb1f382f2b5d97297 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 9 Aug 2024 12:27:44 +0200 Subject: [PATCH 05/13] Added api-call to get all Attachments of a Publication --- appinfo/routes.php | 5 ++ lib/Controller/AttachmentsController.php | 2 +- lib/Controller/PublicationsController.php | 68 ++++++++++++++++++----- lib/Db/AttachmentMapper.php | 11 ++++ 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 3a3e2056..8085cf7e 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,5 +1,9 @@ create('myapp_api_publication_attachments', '/api/publications/{id}/attachments') +// ->get() +// ->action([\OCA\OpenCatalogi\Controller\PublicationsController::class, 'getAttachments']); + return [ 'resources' => [ 'metadata' => ['url' => '/api/metadata'], @@ -14,6 +18,7 @@ ['name' => 'dashboard#page', 'url' => '/', 'verb' => 'GET'], ['name' => 'metadata#page', 'url' => '/metadata', 'verb' => 'GET'], ['name' => 'publications#page', 'url' => '/publications', 'verb' => 'GET'], + ['name' => 'publications#attachments', 'url' => '/api/publications/{id}/attachments', 'verb' => 'GET', 'requirements' => ['id' => '.+']], ['name' => 'catalogi#page', 'url' => '/catalogi', 'verb' => 'GET'], ['name' => 'search#index', 'url' => '/search', 'verb' => 'GET'], ['name' => 'search#index', 'url' => '/api/search', 'verb' => 'GET'], diff --git a/lib/Controller/AttachmentsController.php b/lib/Controller/AttachmentsController.php index 67bbcb21..903f984c 100644 --- a/lib/Controller/AttachmentsController.php +++ b/lib/Controller/AttachmentsController.php @@ -100,7 +100,7 @@ public function index(ObjectService $objectService): JSONResponse if ($this->config->hasKey(app: $this->appName, key: 'mongoStorage') === false || $this->config->getValueString(app: $this->appName, key: 'mongoStorage') !== '1' ) { - return new JSONResponse(['results' =>$this->attachmentMapper->findAll()]); + return new JSONResponse(['results' => $this->attachmentMapper->findAll()]); } $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); $dbConfig['headers']['api-key'] = $this->config->getValueString(app: $this->appName, key: 'mongodbKey'); diff --git a/lib/Controller/PublicationsController.php b/lib/Controller/PublicationsController.php index 6534ff1d..ea7f786f 100644 --- a/lib/Controller/PublicationsController.php +++ b/lib/Controller/PublicationsController.php @@ -4,12 +4,14 @@ use Elastic\Elasticsearch\Client; use GuzzleHttp\Exception\GuzzleException; +use OCA\OpenCatalogi\Db\AttachmentMapper; use OCA\opencatalogi\lib\Db\Publication; use OCA\OpenCatalogi\Db\PublicationMapper; use OCA\OpenCatalogi\Service\ElasticSearchService; use OCA\OpenCatalogi\Service\ObjectService; use OCA\OpenCatalogi\Service\SearchService; use OCP\AppFramework\Controller; +use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\IAppConfig; @@ -24,6 +26,7 @@ public function __construct $appName, IRequest $request, private readonly PublicationMapper $publicationMapper, + private readonly AttachmentMapper $attachmentMapper, private readonly IAppConfig $config ) { @@ -83,17 +86,17 @@ public function page(?string $getParameter) * @NoCSRFRequired */ public function catalog(string|int $id): TemplateResponse - { - // The TemplateResponse loads the 'main.php' - // defined in our app's 'templates' folder. - // We pass the $getParameter variable to the template - // so that the value is accessible in the template. - return new TemplateResponse( - $this->appName, - 'PublicationsIndex', - [] - ); - } + { + // The TemplateResponse loads the 'main.php' + // defined in our app's 'templates' folder. + // We pass the $getParameter variable to the template + // so that the value is accessible in the template. + return new TemplateResponse( + $this->appName, + 'PublicationsIndex', + [] + ); + } /** * @NoAdminRequired @@ -133,16 +136,55 @@ public function index(ObjectService $objectService, SearchService $searchService return new JSONResponse($results); } + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function attachments(string|int $id, ObjectService $objectService): JSONResponse + { + $publication = $this->show($id, $objectService)->getData(); + if ($this->config->hasKey(app: $this->appName, key: 'mongoStorage') === false + || $this->config->getValueString(app: $this->appName, key: 'mongoStorage') !== '1' + ) { + $publication = $publication->jsonSerialize(); + } + + $attachments = $publication['attachments']; + + if ($this->config->hasKey($this->appName, 'mongoStorage') === false + || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' + ) { + return new JSONResponse(['results' => $this->attachmentMapper->findMultiple($attachments)]); + } + + $filters = []; + $filters['id']['$in'] = $attachments; + + $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); + $dbConfig['headers']['api-key'] = $this->config->getValueString(app: $this->appName, key: 'mongodbKey'); + $dbConfig['mongodbCluster'] = $this->config->getValueString(app: $this->appName, key: 'mongodbCluster'); + + $filters['_schema'] = 'attachment'; + + $result = $objectService->findObjects(filters: $filters, config: $dbConfig); + + return new JSONResponse(['results' => $result['documents']]); + } + /** * @NoAdminRequired * @NoCSRFRequired */ public function show(string|int $id, ObjectService $objectService): JSONResponse { - if($this->config->hasKey($this->appName, 'mongoStorage') === false + if ($this->config->hasKey($this->appName, 'mongoStorage') === false || $this->config->getValueString($this->appName, 'mongoStorage') !== '1' ) { - return new JSONResponse($this->publicationMapper->find(id: (int) $id)); + try { + return new JSONResponse($this->publicationMapper->find(id: (int) $id)); + } catch (DoesNotExistException $exception) { + return new JSONResponse(data: ['error' => 'Not Found'], statusCode: 404); + } } $dbConfig['base_uri'] = $this->config->getValueString(app: $this->appName, key: 'mongodbLocation'); diff --git a/lib/Db/AttachmentMapper.php b/lib/Db/AttachmentMapper.php index 9e97af7e..9c32b8b6 100644 --- a/lib/Db/AttachmentMapper.php +++ b/lib/Db/AttachmentMapper.php @@ -28,6 +28,17 @@ public function find(int $id): Attachment return $this->findEntity(query: $qb); } + public function findMultiple(array $ids): array + { + $qb = $this->db->getQueryBuilder(); + + $qb->select('*') + ->from('attachments') + ->where($qb->expr()->in('id', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))); + + return $this->findEntities(query: $qb); + } + public function findAll($limit = null, $offset = null): array { $qb = $this->db->getQueryBuilder(); From 791fbc25ac1a33ee6aad88d0271d6700a33d9701 Mon Sep 17 00:00:00 2001 From: Wilco Louwerse Date: Fri, 9 Aug 2024 12:29:35 +0200 Subject: [PATCH 06/13] Remove testing code --- appinfo/routes.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 8085cf7e..a14b912e 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,9 +1,5 @@ create('myapp_api_publication_attachments', '/api/publications/{id}/attachments') -// ->get() -// ->action([\OCA\OpenCatalogi\Controller\PublicationsController::class, 'getAttachments']); - return [ 'resources' => [ 'metadata' => ['url' => '/api/metadata'], From 2721e585afe3c896eac1a773c54ea59b4b01984c Mon Sep 17 00:00:00 2001 From: Barry Brands Date: Fri, 9 Aug 2024 12:48:50 +0200 Subject: [PATCH 07/13] Fix findAll $sort --- lib/Db/PublicationMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Db/PublicationMapper.php b/lib/Db/PublicationMapper.php index 12e349d2..7099d677 100644 --- a/lib/Db/PublicationMapper.php +++ b/lib/Db/PublicationMapper.php @@ -97,7 +97,7 @@ public function count(?array $filters = [], ?array $searchConditions = [], ?arra return $row['count']; } - public function findAll(?int $limit = null, ?int $offset = null, ?array $filters = [], ?array $searchConditions = [], ?array $searchParams = []): array + public function findAll(?int $limit = null, ?int $offset = null, ?array $filters = [], ?array $searchConditions = [], ?array $searchParams = [], ?array $sort = []): array { $qb = $this->db->getQueryBuilder(); From 72b7759f32f76445fb9becedbae3ae96e7d1aebf Mon Sep 17 00:00:00 2001 From: Thijn Date: Fri, 9 Aug 2024 13:34:47 +0200 Subject: [PATCH 08/13] fixed reset --- src/modals/metaData/AddMetaDataModal.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/modals/metaData/AddMetaDataModal.vue b/src/modals/metaData/AddMetaDataModal.vue index d18a8cfd..2f1abd0e 100644 --- a/src/modals/metaData/AddMetaDataModal.vue +++ b/src/modals/metaData/AddMetaDataModal.vue @@ -6,7 +6,7 @@ import { navigationStore, metadataStore } from '../../store/store.js' + @close="closeModal">