1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improve linting

This commit is contained in:
Patrik J. Braun 2023-09-06 14:20:35 +02:00
parent 7ee19cef23
commit 5f1ce6dd81
6 changed files with 18 additions and 16 deletions

View File

@ -9,7 +9,6 @@ import {SharingDTO} from '../../common/entities/SharingDTO';
import {Utils} from '../../common/Utils';
import {LoggerRouter} from '../routes/LoggerRouter';
import {TAGS} from '../../common/config/public/ClientConfig';
import {ConfigDiagnostics} from '../model/diagnostics/ConfigDiagnostics';
const forcedDebug = process.env['NODE_ENV'] === 'debug';

View File

@ -1,6 +1,8 @@
import {FfmpegCommand} from 'fluent-ffmpeg';
/* eslint-disable @typescript-eslint/no-var-requires */
export class FFmpegFactory {
public static get(): any {
public static get(): (path: string) => FfmpegCommand {
const ffmpeg = require('fluent-ffmpeg');
try {
const ffmpegPath = require('ffmpeg-static');

View File

@ -7,7 +7,6 @@ import {SearchQueryDTO} from '../../../common/entities/SearchQueryDTO';
import {SavedSearchEntity} from './enitites/album/SavedSearchEntity';
import {Logger} from '../../Logger';
import {IObjectManager} from './IObjectManager';
import {DirectoryEntity} from './enitites/DirectoryEntity';
const LOG_TAG = '[AlbumManager]';

View File

@ -4,7 +4,6 @@ import {MediaEntity} from './enitites/MediaEntity';
import {DiskMangerWorker} from '../threading/DiskMangerWorker';
import {ObjectManagers} from '../ObjectManagers';
import {DatabaseType} from '../../../common/config/private/PrivateConfig';
import {SortingMethod} from '../../../common/entities/SortingMethods';
import {SQLConnection} from './SQLConnection';
import {SearchQueryDTO, SearchQueryTypes, TextSearch,} from '../../../common/entities/SearchQueryDTO';
import {DirectoryEntity} from './enitites/DirectoryEntity';
@ -111,7 +110,7 @@ export class CoverManager implements IObjectManager {
.limit(1)
.getOne();
} catch (e) {
Logger.error('Cant get album cover using:', JSON.stringify(album.searchQuery), JSON.stringify(Config.AlbumCover.SearchQuery));
Logger.error(LOG_TAG, 'Cant get album cover using:', JSON.stringify(album.searchQuery), JSON.stringify(Config.AlbumCover.SearchQuery));
throw e;
}
}
@ -120,7 +119,7 @@ export class CoverManager implements IObjectManager {
try {
coverMedia = await coverQuery().limit(1).getOne();
} catch (e) {
Logger.error('Cant get album cover using:', JSON.stringify(album.searchQuery));
Logger.error(LOG_TAG, 'Cant get album cover using:', JSON.stringify(album.searchQuery));
throw e;
}
}

View File

@ -14,7 +14,6 @@ import {Logger} from '../../Logger';
import {ObjectManagers} from '../ObjectManagers';
import {DuplicatesDTO} from '../../../common/entities/DuplicatesDTO';
import {ReIndexingSensitivity} from '../../../common/config/private/PrivateConfig';
import {IObjectManager} from './IObjectManager';
const LOG_TAG = '[GalleryManager]';
@ -177,7 +176,7 @@ export class GalleryManager {
let duplicates = await mediaRepository
.createQueryBuilder('media')
.innerJoin(
(query): any =>
(query) =>
query
.from(MediaEntity, 'innerMedia')
.select([
@ -248,7 +247,7 @@ export class GalleryManager {
duplicates = await mediaRepository
.createQueryBuilder('media')
.innerJoin(
(query): any =>
(query) =>
query
.from(MediaEntity, 'innerMedia')
.select([
@ -319,7 +318,11 @@ export class GalleryManager {
dir.isPartial = true;
}
protected async getDirIdAndTime(connection: Connection, name: string, path: string): Promise<{ id: number, lastScanned: number, lastModified: number }> {
protected async getDirIdAndTime(connection: Connection, name: string, path: string): Promise<{
id: number,
lastScanned: number,
lastModified: number
}> {
return await connection
.getRepository(DirectoryEntity)
.createQueryBuilder('directory')

View File

@ -1,4 +1,4 @@
import {DirectoryDTOUtils, DirectoryPathDTO, ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
import {DirectoryBaseDTO, DirectoryDTOUtils, DirectoryPathDTO, ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
import {DirectoryEntity} from './enitites/DirectoryEntity';
import {SQLConnection} from './SQLConnection';
import {DiskManager} from '../DiskManger';
@ -261,8 +261,8 @@ export class IndexingManager {
// directory found
childDirectories.splice(dirIndex, 1);
} else {
// dir does not exists yet
directory.parent = {id: currentDirId} as any;
// dir does not exist yet
directory.parent = {id: currentDirId} as ParentDirectoryDTO;
(directory as DirectoryEntity).lastScanned = null; // new child dir, not fully scanned yet
const d = await directoryRepository.insert(
directory as DirectoryEntity
@ -311,7 +311,7 @@ export class IndexingManager {
item.directory = null;
metaFile = Utils.clone(item);
item.directory = scannedDirectory;
metaFile.directory = {id: currentDirID} as any;
metaFile.directory = {id: currentDirID} as DirectoryBaseDTO;
metaFilesToSave.push(metaFile);
}
}
@ -374,7 +374,7 @@ export class IndexingManager {
// Media not in DB yet
media[i].directory = null;
mediaItem = Utils.clone(media[i]);
mediaItem.directory = {id: parentDirId} as any;
mediaItem.directory = {id: parentDirId} as DirectoryBaseDTO;
(MediaDTOUtils.isPhoto(mediaItem)
? mediaChange.insertP
: mediaChange.insertV