From 7ab2d9e62d0f87ec6f8c910e1165988d2182b1a1 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Sun, 14 Mar 2021 17:45:32 +0100 Subject: [PATCH] Fixing reference issues --- package-lock.json | 3 ++- .../model/database/interfaces/IGalleryManager.ts | 12 ------------ .../model/database/interfaces/ISearchManager.ts | 1 - src/backend/model/database/memory/GalleryManager.ts | 6 +----- src/backend/model/database/sql/GalleryManager.ts | 6 ++---- src/common/entities/RandomQueryDTO.ts | 0 src/frontend/app/ui/gallery/gallery.component.ts | 10 +++------- 7 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 src/common/entities/RandomQueryDTO.ts diff --git a/package-lock.json b/package-lock.json index bf18697b..0e2f15eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13512,7 +13512,8 @@ "natural-orderby": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/natural-orderby/-/natural-orderby-2.0.3.tgz", - "integrity": "sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q==" + "integrity": "sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q==", + "dev": true }, "needle": { "version": "2.5.2", diff --git a/src/backend/model/database/interfaces/IGalleryManager.ts b/src/backend/model/database/interfaces/IGalleryManager.ts index 79a635f3..22255335 100644 --- a/src/backend/model/database/interfaces/IGalleryManager.ts +++ b/src/backend/model/database/interfaces/IGalleryManager.ts @@ -1,16 +1,4 @@ import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO'; -import {PhotoDTO} from '../../../../common/entities/PhotoDTO'; -import {OrientationType} from '../../../../common/entities/RandomQueryDTO'; - -export interface RandomQuery { - directory?: string; - recursive?: boolean; - orientation?: OrientationType; - fromDate?: Date; - toDate?: Date; - minResolution?: number; - maxResolution?: number; -} export interface IGalleryManager { listDirectory(relativeDirectoryName: string, diff --git a/src/backend/model/database/interfaces/ISearchManager.ts b/src/backend/model/database/interfaces/ISearchManager.ts index 6f3ee071..37272cfe 100644 --- a/src/backend/model/database/interfaces/ISearchManager.ts +++ b/src/backend/model/database/interfaces/ISearchManager.ts @@ -2,7 +2,6 @@ import {AutoCompleteItem} from '../../../../common/entities/AutoCompleteItem'; import {SearchResultDTO} from '../../../../common/entities/SearchResultDTO'; import {SearchQueryDTO, SearchQueryTypes} from '../../../../common/entities/SearchQueryDTO'; import {PhotoDTO} from '../../../../common/entities/PhotoDTO'; -import {RandomQuery} from './IGalleryManager'; export interface ISearchManager { autocomplete(text: string, type: SearchQueryTypes): Promise; diff --git a/src/backend/model/database/memory/GalleryManager.ts b/src/backend/model/database/memory/GalleryManager.ts index 8ed1473e..44605713 100644 --- a/src/backend/model/database/memory/GalleryManager.ts +++ b/src/backend/model/database/memory/GalleryManager.ts @@ -1,11 +1,10 @@ import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO'; -import {IGalleryManager, RandomQuery} from '../interfaces/IGalleryManager'; +import {IGalleryManager} from '../interfaces/IGalleryManager'; import * as path from 'path'; import * as fs from 'fs'; import {DiskManager} from '../../DiskManger'; import {ProjectPath} from '../../../ProjectPath'; import {Config} from '../../../../common/config/private/Config'; -import {PhotoDTO} from '../../../../common/entities/PhotoDTO'; import {DiskMangerWorker} from '../../threading/DiskMangerWorker'; import {ServerConfig} from '../../../../common/config/private/PrivateConfig'; @@ -25,7 +24,4 @@ export class GalleryManager implements IGalleryManager { return DiskManager.scanDirectory(relativeDirectoryName); } - getRandomPhoto(queryFilter: RandomQuery): Promise { - throw new Error('Random media is not supported without database'); - } } diff --git a/src/backend/model/database/sql/GalleryManager.ts b/src/backend/model/database/sql/GalleryManager.ts index 0f97dbc8..5bccd17b 100644 --- a/src/backend/model/database/sql/GalleryManager.ts +++ b/src/backend/model/database/sql/GalleryManager.ts @@ -1,4 +1,4 @@ -import {IGalleryManager, RandomQuery} from '../interfaces/IGalleryManager'; +import {IGalleryManager} from '../interfaces/IGalleryManager'; import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO'; import * as path from 'path'; import * as fs from 'fs'; @@ -9,8 +9,7 @@ import {ProjectPath} from '../../../ProjectPath'; import {Config} from '../../../../common/config/private/Config'; import {ISQLGalleryManager} from './IGalleryManager'; import {PhotoDTO} from '../../../../common/entities/PhotoDTO'; -import {OrientationType} from '../../../../common/entities/RandomQueryDTO'; -import {Brackets, Connection, SelectQueryBuilder} from 'typeorm'; +import {Connection} from 'typeorm'; import {MediaEntity} from './enitites/MediaEntity'; import {VideoEntity} from './enitites/VideoEntity'; import {DiskMangerWorker} from '../../threading/DiskMangerWorker'; @@ -19,7 +18,6 @@ import {FaceRegionEntry} from './enitites/FaceRegionEntry'; import {ObjectManagers} from '../../ObjectManagers'; import {DuplicatesDTO} from '../../../../common/entities/DuplicatesDTO'; import {ServerConfig} from '../../../../common/config/private/PrivateConfig'; -import {SearchQueryDTO} from '../../../../common/entities/SearchQueryDTO'; const LOG_TAG = '[GalleryManager]'; diff --git a/src/common/entities/RandomQueryDTO.ts b/src/common/entities/RandomQueryDTO.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/src/frontend/app/ui/gallery/gallery.component.ts b/src/frontend/app/ui/gallery/gallery.component.ts index 64977ef2..2ab6db6a 100644 --- a/src/frontend/app/ui/gallery/gallery.component.ts +++ b/src/frontend/app/ui/gallery/gallery.component.ts @@ -3,7 +3,6 @@ import {AuthenticationService} from '../../model/network/authentication.service' import {ActivatedRoute, Params, Router} from '@angular/router'; import {GalleryService} from './gallery.service'; import {GalleryGridComponent} from './grid/grid.gallery.component'; -import {SearchTypes} from '../../../../common/entities/AutoCompleteItem'; import {Config} from '../../../../common/config/public/Config'; import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO'; import {SearchResultDTO} from '../../../../common/entities/SearchResultDTO'; @@ -18,8 +17,7 @@ import {PhotoDTO} from '../../../../common/entities/PhotoDTO'; import {QueryParams} from '../../../../common/QueryParams'; import {SeededRandomService} from '../../model/seededRandom.service'; import {take} from 'rxjs/operators'; -import {SearchQueryTypes} from '../../../../common/entities/SearchQueryDTO'; -import { compare } from 'natural-orderby'; +import {compare} from 'natural-orderby'; @Component({ selector: 'app-gallery', @@ -38,7 +36,6 @@ export class GalleryComponent implements OnInit, OnDestroy { public isPhotoWithLocation = false; public countDown: { day: number, hour: number, minute: number, second: number } = null; public readonly mapEnabled: boolean; - readonly SearchTypes: typeof SearchTypes; private $counter: Observable; private subscription: { [key: string]: Subscription } = { content: null, @@ -55,7 +52,6 @@ export class GalleryComponent implements OnInit, OnDestroy { private _navigation: NavigationService, private rndService: SeededRandomService) { this.mapEnabled = Config.Client.Map.enabled; - this.SearchTypes = SearchTypes; PageHelper.showScrollY(); } @@ -173,10 +169,10 @@ export class GalleryComponent implements OnInit, OnDestroy { this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare()(a.lastModified, b.lastModified)); break; case SortingMethods.descName: - this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({ order: 'desc' })(a.name, b.name)); + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.name, b.name)); break; case SortingMethods.descDate: - this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({ order: 'desc' })(a.lastModified, b.lastModified)); + this.directories.sort((a: DirectoryDTO, b: DirectoryDTO) => compare({order: 'desc'})(a.lastModified, b.lastModified)); break; case SortingMethods.random: this.rndService.setSeed(this.directories.length);