1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-07-15 01:24:25 +02:00

updating node to v16 and angular to v12

This commit is contained in:
Patrik J. Braun
2022-03-30 22:18:02 +02:00
parent 0e4063fe39
commit a2e576ec27
26 changed files with 15829 additions and 18031 deletions

View File

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [16.x]
services: services:
mariadb: mariadb:

View File

@ -1,7 +1,7 @@
dist: xenial dist: xenial
language: node_js language: node_js
node_js: node_js:
- '14' - '16'
env: env:
- PORT=35000 MYSQL_HOST='localhost' MYSQL_PASSWORD='' MYSQL_USERNAME='root' MYSQL_DATABASE='pigallery2_test' - PORT=35000 MYSQL_HOST='localhost' MYSQL_PASSWORD='' MYSQL_USERNAME='root' MYSQL_DATABASE='pigallery2_test'
services: services:

View File

@ -83,7 +83,7 @@
} }
], ],
"styles": [ "styles": [
"bootstrap/dist/css/bootstrap.min.css", "bootstrap/dist/css/bootstrap.css",
"ngx-bootstrap/datepicker/bs-datepicker.css", "ngx-bootstrap/datepicker/bs-datepicker.css",
"open-iconic/font/css/open-iconic-bootstrap.css", "open-iconic/font/css/open-iconic-bootstrap.css",
"ngx-toastr/toastr.css", "ngx-toastr/toastr.css",
@ -93,7 +93,7 @@
"src/frontend/styles.css" "src/frontend/styles.css"
], ],
"scripts": [ "scripts": [
"node_modules/marked/lib/marked.js" "node_modules/marked/marked.min.js"
], ],
"i18nMissingTranslation": "warning" "i18nMissingTranslation": "warning"
}, },

View File

@ -1,6 +1,6 @@
#-----------------BUILDER----------------- #-----------------BUILDER-----------------
#----------------------------------------- #-----------------------------------------
FROM node:14-alpine3.15 AS builder FROM node:16-alpine3.15 AS builder
RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \ RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.15/community/ \
python3 build-base sqlite-dev sqlite-libs vips-dev fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python python3 build-base sqlite-dev sqlite-libs vips-dev fftw-dev gcc g++ make libc6-compat && ln -snf /usr/bin/python3 /usr/bin/python
COPY pigallery2-release /app COPY pigallery2-release /app
@ -14,7 +14,7 @@ RUN mkdir -p /app/data/config && \
#-----------------MAIN-------------------- #-----------------MAIN--------------------
#----------------------------------------- #-----------------------------------------
FROM node:14-alpine3.15 AS main FROM node:16-alpine3.15 AS main
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
# overrides only the default value of the settings (the actualy value can be overwritten through config.json) # overrides only the default value of the settings (the actualy value can be overwritten through config.json)

View File

@ -1,6 +1,6 @@
#-----------------BUILDER----------------- #-----------------BUILDER-----------------
#----------------------------------------- #-----------------------------------------
FROM node:14-bullseye AS builder FROM node:16-bullseye AS builder
COPY pigallery2-release /app COPY pigallery2-release /app
WORKDIR /app WORKDIR /app
RUN npm install --unsafe-perm RUN npm install --unsafe-perm
@ -12,7 +12,7 @@ RUN mkdir -p /app/data/config && \
#-----------------MAIN-------------------- #-----------------MAIN--------------------
#----------------------------------------- #-----------------------------------------
FROM node:14-bullseye-slim AS main FROM node:16-bullseye-slim AS main
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
# overrides only the default value of the settings (the actualy value can be overwritten through config.json) # overrides only the default value of the settings (the actualy value can be overwritten through config.json)

View File

@ -1,6 +1,6 @@
#-----------------BUILDER----------------- #-----------------BUILDER-----------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster AS builder FROM node:16-buster AS builder
COPY pigallery2-release /app COPY pigallery2-release /app
WORKDIR /app WORKDIR /app
RUN npm install --unsafe-perm RUN npm install --unsafe-perm
@ -12,7 +12,7 @@ RUN mkdir -p /app/data/config && \
#-----------------MAIN-------------------- #-----------------MAIN--------------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster-slim AS main FROM node:16-buster-slim AS main
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
# overrides only the default value of the settings (the actualy value can be overwritten through config.json) # overrides only the default value of the settings (the actualy value can be overwritten through config.json)

View File

@ -1,6 +1,6 @@
#-----------------BUILDER----------------- #-----------------BUILDER-----------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster AS builder FROM node:16-buster AS builder
# LABEL maintainer="Patrik J. Braun" # LABEL maintainer="Patrik J. Braun"
# copying only package{-lock}.json to make node_modules cachable # copying only package{-lock}.json to make node_modules cachable
RUN git clone https://github.com/bpatrik/pigallery2.git /build RUN git clone https://github.com/bpatrik/pigallery2.git /build
@ -16,7 +16,7 @@ RUN npm install --unsafe-perm \
#-----------------MAIN-------------------- #-----------------MAIN--------------------
#----------------------------------------- #-----------------------------------------
FROM node:14-buster-slim AS main FROM node:16-buster-slim AS main
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
# overrides only the default value of the settings (the actualy value can be overwritten through config.json) # overrides only the default value of the settings (the actualy value can be overwritten through config.json)

33643
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "12.2.16", "@angular-devkit/build-angular": "12.2.16",
"@angular-devkit/build-optimizer": "0.1102.17", "@angular-devkit/build-optimizer": "0.1202.16",
"@angular/animations": "12.2.16", "@angular/animations": "12.2.16",
"@angular/cli": "12.2.16", "@angular/cli": "12.2.16",
"@angular/common": "12.2.16", "@angular/common": "12.2.16",
@ -94,7 +94,7 @@
"@types/sharp": "0.30.0", "@types/sharp": "0.30.0",
"@types/winston": "2.4.4", "@types/winston": "2.4.4",
"@types/xml2js": "0.4.9", "@types/xml2js": "0.4.9",
"bootstrap": "5.1.3", "bootstrap": "4.6.1",
"chai": "4.3.6", "chai": "4.3.6",
"chai-http": "4.3.0", "chai-http": "4.3.0",
"codelyzer": "6.0.2", "codelyzer": "6.0.2",
@ -124,10 +124,10 @@
"mocha": "9.2.2", "mocha": "9.2.2",
"ngx-bootstrap": "6.2.0", "ngx-bootstrap": "6.2.0",
"ngx-clipboard": "14.0.2", "ngx-clipboard": "14.0.2",
"ngx-cookie-service": "11.0.2", "ngx-cookie-service": "12.0.3",
"ngx-markdown": "11.2.0", "ngx-markdown": "12.1.0",
"ngx-device-detector": "3.0.0", "ngx-device-detector": "3.0.0",
"ngx-toastr": "13.2.1", "ngx-toastr": "12.1.0",
"nyc": "15.1.0", "nyc": "15.1.0",
"open-iconic": "1.1.1", "open-iconic": "1.1.1",
"protractor": "7.0.0", "protractor": "7.0.0",
@ -152,6 +152,6 @@
"mysql": "2.18.1" "mysql": "2.18.1"
}, },
"engines": { "engines": {
"node": ">=14.14 <15.0" "node": ">=16 <17.0"
} }
} }

View File

@ -1,10 +1,10 @@
import * as cluster from 'cluster'; import * as cluster from 'cluster';
import {Server} from './server';
import {Worker} from './model/threading/Worker';
if (cluster.isMaster) { if ((cluster as any).isMaster) {
const Server = require('./server').Server;
// tslint:disable-next-line:no-unused-expression // tslint:disable-next-line:no-unused-expression
new Server(); new Server();
} else { } else {
const Worker = require('./model/threading/Worker').Worker;
Worker.process(); Worker.process();
} }

View File

@ -1,8 +1,9 @@
import {SharingDTO} from '../../../../common/entities/SharingDTO'; import {SharingDTO} from '../../../../common/entities/SharingDTO';
import {IObjectManager} from './IObjectManager'; import {IObjectManager} from './IObjectManager';
import {FindOptionsWhere} from 'typeorm';
export interface ISharingManager extends IObjectManager { export interface ISharingManager extends IObjectManager {
findOne(filter: any): Promise<SharingDTO>; findOne(filter: FindOptionsWhere<SharingDTO>): Promise<SharingDTO>;
createSharing(sharing: SharingDTO): Promise<SharingDTO>; createSharing(sharing: SharingDTO): Promise<SharingDTO>;

View File

@ -1,10 +1,11 @@
import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO'; import {UserDTO, UserRoles} from '../../../../common/entities/UserDTO';
import {IObjectManager} from './IObjectManager'; import {IObjectManager} from './IObjectManager';
import {FindOptionsWhere} from 'typeorm';
export interface IUserManager extends IObjectManager { export interface IUserManager extends IObjectManager {
findOne(filter: any): Promise<UserDTO>; findOne(filter: FindOptionsWhere<UserDTO>): Promise<UserDTO>;
find(filter: any): Promise<UserDTO[]>; find(filter: FindOptionsWhere<UserDTO>): Promise<UserDTO[]>;
createUser(user: UserDTO): Promise<UserDTO>; createUser(user: UserDTO): Promise<UserDTO>;

View File

@ -36,7 +36,7 @@ export class AlbumManager implements IAlbumManager {
public async addIfNotExistSavedSearch(name: string, searchQuery: SearchQueryDTO, lockedAlbum: boolean): Promise<void> { public async addIfNotExistSavedSearch(name: string, searchQuery: SearchQueryDTO, lockedAlbum: boolean): Promise<void> {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const album = await connection.getRepository(SavedSearchEntity) const album = await connection.getRepository(SavedSearchEntity)
.findOne({name, searchQuery}); .findOneBy({name, searchQuery});
if (album) { if (album) {
return; return;
} }
@ -53,7 +53,7 @@ export class AlbumManager implements IAlbumManager {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
if (await connection.getRepository(AlbumBaseEntity) if (await connection.getRepository(AlbumBaseEntity)
.count({id, locked: false}) !== 1) { .countBy({id, locked: false}) !== 1) {
throw new Error('Could not delete album, id:' + id); throw new Error('Could not delete album, id:' + id);
} }

View File

@ -1,5 +1,5 @@
import 'reflect-metadata'; import 'reflect-metadata';
import {Connection, ConnectionOptions, createConnection, getConnection} from 'typeorm'; import {Connection, DataSourceOptions, createConnection, getConnection} from 'typeorm';
import {UserEntity} from './enitites/UserEntity'; import {UserEntity} from './enitites/UserEntity';
import {UserRoles} from '../../../../common/entities/UserDTO'; import {UserRoles} from '../../../../common/entities/UserDTO';
import {PhotoEntity} from './enitites/PhotoEntity'; import {PhotoEntity} from './enitites/PhotoEntity';
@ -104,7 +104,7 @@ export class SQLConnection {
if (Array.isArray(Config.Server.Database.enforcedUsers) && if (Array.isArray(Config.Server.Database.enforcedUsers) &&
Config.Server.Database.enforcedUsers.length > 0) { Config.Server.Database.enforcedUsers.length > 0) {
for (const uc of Config.Server.Database.enforcedUsers) { for (const uc of Config.Server.Database.enforcedUsers) {
const user = await userRepository.findOne({name: uc.name}); const user = await userRepository.findOneBy({name: uc.name});
if (!user) { if (!user) {
Logger.info(LOG_TAG, 'Saving enforced user: ' + uc.name); Logger.info(LOG_TAG, 'Saving enforced user: ' + uc.name);
const a = new UserEntity(); const a = new UserEntity();
@ -123,7 +123,7 @@ export class SQLConnection {
} }
// Add dummy Admin to the db // Add dummy Admin to the db
const admins = await userRepository.find({role: UserRoles.Admin}); const admins = await userRepository.findBy({role: UserRoles.Admin});
if (admins.length === 0) { if (admins.length === 0) {
const a = new UserEntity(); const a = new UserEntity();
a.name = 'admin'; a.name = 'admin';
@ -132,7 +132,7 @@ export class SQLConnection {
await userRepository.save(a); await userRepository.save(a);
} }
const defAdmin = await userRepository.findOne({name: 'admin', role: UserRoles.Admin}); const defAdmin = await userRepository.findOneBy({name: 'admin', role: UserRoles.Admin});
if (defAdmin && PasswordHelper.comparePassword('admin', defAdmin.password)) { if (defAdmin && PasswordHelper.comparePassword('admin', defAdmin.password)) {
NotificationManager.error('Using default admin user!', 'You are using the default admin/admin user/password, please change or remove it.'); NotificationManager.error('Using default admin user!', 'You are using the default admin/admin user/password, please change or remove it.');
} }
@ -155,7 +155,7 @@ export class SQLConnection {
return path.join(ProjectPath.getAbsolutePath(config.dbFolder), 'sqlite.db'); return path.join(ProjectPath.getAbsolutePath(config.dbFolder), 'sqlite.db');
} }
private static async createConnection(options: ConnectionOptions): Promise<Connection> { private static async createConnection(options: DataSourceOptions): Promise<Connection> {
if (options.type === 'sqlite' || options.type === 'better-sqlite3') { if (options.type === 'sqlite' || options.type === 'better-sqlite3') {
return await createConnection(options); return await createConnection(options);
} }
@ -179,7 +179,7 @@ export class SQLConnection {
private static async schemeSync(connection: Connection): Promise<void> { private static async schemeSync(connection: Connection): Promise<void> {
let version = null; let version = null;
try { try {
version = await connection.getRepository(VersionEntity).findOne(); version = (await connection.getRepository(VersionEntity).find())[0];
} catch (ex) { } catch (ex) {
} }
if (version && version.version === DataStructureVersion) { if (version && version.version === DataStructureVersion) {
@ -209,8 +209,8 @@ export class SQLConnection {
} }
} }
private static getDriver(config: ServerDataBaseConfig): ConnectionOptions { private static getDriver(config: ServerDataBaseConfig): DataSourceOptions {
let driver: ConnectionOptions = null; let driver: DataSourceOptions = null;
if (config.type === DatabaseType.mysql) { if (config.type === DatabaseType.mysql) {
driver = { driver = {
type: 'mysql', type: 'mysql',

View File

@ -4,7 +4,7 @@ import {SQLConnection} from './SQLConnection';
import {SharingEntity} from './enitites/SharingEntity'; import {SharingEntity} from './enitites/SharingEntity';
import {Config} from '../../../../common/config/private/Config'; import {Config} from '../../../../common/config/private/Config';
import {PasswordHelper} from '../../PasswordHelper'; import {PasswordHelper} from '../../PasswordHelper';
import {DeleteResult} from 'typeorm'; import {DeleteResult, FindOptionsWhere} from 'typeorm';
export class SharingManager implements ISharingManager { export class SharingManager implements ISharingManager {
@ -20,7 +20,7 @@ export class SharingManager implements ISharingManager {
async deleteSharing(sharingKey: string): Promise<void> { async deleteSharing(sharingKey: string): Promise<void> {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const sharing = await connection.getRepository(SharingEntity).findOne({sharingKey}); const sharing = await connection.getRepository(SharingEntity).findOneBy({sharingKey});
await connection.getRepository(SharingEntity).remove(sharing); await connection.getRepository(SharingEntity).remove(sharing);
} }
@ -32,10 +32,10 @@ export class SharingManager implements ISharingManager {
.leftJoinAndSelect('share.creator', 'creator').getMany(); .leftJoinAndSelect('share.creator', 'creator').getMany();
} }
async findOne(filter: any): Promise<SharingDTO> { async findOne(filter: FindOptionsWhere<SharingDTO>): Promise<SharingDTO> {
await SharingManager.removeExpiredLink(); await SharingManager.removeExpiredLink();
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
return await connection.getRepository(SharingEntity).findOne(filter); return await connection.getRepository(SharingEntity).findOneBy(filter);
} }
async createSharing(sharing: SharingDTO): Promise<SharingDTO> { async createSharing(sharing: SharingDTO): Promise<SharingDTO> {
@ -50,7 +50,7 @@ export class SharingManager implements ISharingManager {
async updateSharing(inSharing: SharingDTO, forceUpdate: boolean): Promise<SharingDTO> { async updateSharing(inSharing: SharingDTO, forceUpdate: boolean): Promise<SharingDTO> {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const sharing = await connection.getRepository(SharingEntity).findOne({ const sharing = await connection.getRepository(SharingEntity).findOneBy({
id: inSharing.id, id: inSharing.id,
creator: inSharing.creator.id as any, creator: inSharing.creator.id as any,
path: inSharing.path path: inSharing.path

View File

@ -3,6 +3,7 @@ import {IUserManager} from '../interfaces/IUserManager';
import {UserEntity} from './enitites/UserEntity'; import {UserEntity} from './enitites/UserEntity';
import {SQLConnection} from './SQLConnection'; import {SQLConnection} from './SQLConnection';
import {PasswordHelper} from '../../PasswordHelper'; import {PasswordHelper} from '../../PasswordHelper';
import {FindOptionsWhere} from 'typeorm';
export class UserManager implements IUserManager { export class UserManager implements IUserManager {
@ -11,11 +12,11 @@ export class UserManager implements IUserManager {
} }
public async findOne(filter: any): Promise<any> { public async findOne(filter: FindOptionsWhere<UserEntity>): Promise<any> {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const pass = filter.password; const pass = filter.password as string;
delete filter.password; delete filter.password;
const user = (await connection.getRepository(UserEntity).findOne(filter)); const user = (await connection.getRepository(UserEntity).findOneBy(filter));
if (pass && !PasswordHelper.comparePassword(pass, user.password)) { if (pass && !PasswordHelper.comparePassword(pass, user.password)) {
throw new Error('No entry found'); throw new Error('No entry found');
@ -37,7 +38,7 @@ export class UserManager implements IUserManager {
public async deleteUser(id: number): Promise<any> { public async deleteUser(id: number): Promise<any> {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const user = await connection.getRepository(UserEntity).findOne({id}); const user = await connection.getRepository(UserEntity).findOneBy({id});
return await connection.getRepository(UserEntity).remove(user); return await connection.getRepository(UserEntity).remove(user);
} }
@ -45,7 +46,7 @@ export class UserManager implements IUserManager {
const connection = await SQLConnection.getConnection(); const connection = await SQLConnection.getConnection();
const userRepository = connection.getRepository(UserEntity); const userRepository = connection.getRepository(UserEntity);
const user = await userRepository.findOne({id}); const user = await userRepository.findOneBy({id});
user.role = newRole; user.role = newRole;
return userRepository.save(user); return userRepository.save(user);

View File

@ -14,8 +14,6 @@ import {backendTexts} from '../../../../common/BackendTexts';
import {ProjectPath} from '../../../ProjectPath'; import {ProjectPath} from '../../../ProjectPath';
import {DatabaseType} from '../../../../common/config/private/PrivateConfig'; import {DatabaseType} from '../../../../common/config/private/PrivateConfig';
declare var global: NodeJS.Global;
const LOG_TAG = '[FileJob]'; const LOG_TAG = '[FileJob]';

View File

@ -1,4 +1,5 @@
import * as cluster from 'cluster'; import * as cluster from 'cluster';
import {Worker} from 'cluster';
import {Logger} from '../../Logger'; import {Logger} from '../../Logger';
import {DiskManagerTask, ThumbnailTask, WorkerMessage, WorkerTask, WorkerTaskTypes} from './Worker'; import {DiskManagerTask, ThumbnailTask, WorkerMessage, WorkerTask, WorkerTaskTypes} from './Worker';
import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO'; import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
@ -9,7 +10,7 @@ import {DirectoryScanSettings} from './DiskMangerWorker';
interface WorkerWrapper<O> { interface WorkerWrapper<O> {
worker: cluster.Worker; worker: Worker;
poolTask: TaskQueEntry<WorkerTask, O>; poolTask: TaskQueEntry<WorkerTask, O>;
} }
@ -58,7 +59,7 @@ export class ThreadPool<O> {
} }
private startWorker(): void { private startWorker(): void {
const worker = {poolTask: null, worker: cluster.fork()} as WorkerWrapper<O>; const worker = {poolTask: null, worker: (cluster as any).fork()} as WorkerWrapper<O>;
this.workers.push(worker); this.workers.push(worker);
worker.worker.on('online', (): void => { worker.worker.on('online', (): void => {
ThreadPool.WorkerCount++; ThreadPool.WorkerCount++;

View File

@ -6,7 +6,6 @@ import {MediaDTO} from '../../../common/entities/MediaDTO';
import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO'; import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
declare var process: NodeJS.Process; declare var process: NodeJS.Process;
declare var global: NodeJS.Global;
const LOG_TAG = '[Worker]'; const LOG_TAG = '[Worker]';
export class Worker { export class Worker {

View File

@ -20,10 +20,11 @@ export class LoggerRouter {
} }
req.logged = true; req.logged = true;
const end = res.end; const end = res.end;
res.end = (a?: any, b?: any, c?: any): void => { res.end = (a?: any, b?: any, c?: any) => {
res.end = end; res.end = end;
res.end(a, b, c); res.end(a, b, c);
loggerFn(req.method, req.url, res.statusCode, (Date.now() - req._startTime) + 'ms'); loggerFn(req.method, req.url, res.statusCode, (Date.now() - req._startTime) + 'ms');
return res;
}; };
} }

View File

@ -23,7 +23,10 @@
var ServerInject = {user: <%- JSON.stringify(user); %>, ConfigInject: <%- JSON.stringify(Config); %>} var ServerInject = {user: <%- JSON.stringify(user); %>, ConfigInject: <%- JSON.stringify(Config); %>}
</script> </script>
<script>
<%- customHTMLHead %> <%- customHTMLHead %>
</script>
</head> </head>
<body style="overflow-y: scroll; padding-right: 0 !important;"> <body style="overflow-y: scroll; padding-right: 0 !important;">

View File

@ -4,7 +4,7 @@
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/app", "outDir": "../../out-tsc/app",
"types": [], "types": [],
"target": "es2015", "target": "es2017",
"module": "es2020", "module": "es2020",
"lib": [ "lib": [
"es2018", "es2018",

View File

@ -104,14 +104,14 @@ describe('Typeorm integration', () => {
a.role = UserRoles.Admin; a.role = UserRoles.Admin;
await conn.getRepository(UserEntity).save(a); await conn.getRepository(UserEntity).save(a);
const version = await conn.getRepository(VersionEntity).findOne(); const version = (await conn.getRepository(VersionEntity).find())[0];
version.version--; version.version--;
await conn.getRepository(VersionEntity).save(version); await conn.getRepository(VersionEntity).save(version);
await SQLConnection.close(); await SQLConnection.close();
const conn2 = await SQLConnection.getConnection(); const conn2 = await SQLConnection.getConnection();
const admins = await conn2.getRepository(UserEntity).find({name: 'migrated admin'}); const admins = await conn2.getRepository(UserEntity).findBy({name: 'migrated admin'});
expect(admins.length).to.be.equal(1); expect(admins.length).to.be.equal(1);
}); });

View File

@ -247,7 +247,8 @@ describe('PreviewManager', (sqlHelper: DBTestHelper) => {
const conn = await SQLConnection.getConnection(); const conn = await SQLConnection.getConnection();
const selectDir = async () => { const selectDir = async () => {
return await conn.getRepository(DirectoryEntity).findOne({id: subDir.id}, { return await conn.getRepository(DirectoryEntity).findOne({
where: {id: subDir.id},
join: { join: {
alias: 'dir', alias: 'dir',
leftJoinAndSelect: {preview: 'dir.preview'} leftJoinAndSelect: {preview: 'dir.preview'}

View File

@ -1,7 +1,7 @@
import {ProjectPath} from '../../src/backend/ProjectPath'; import {ProjectPath} from '../../src/backend/ProjectPath';
import {promises as fsp} from 'fs'; import {promises as fsp} from 'fs';
const chai = require('chai'); const chai = require('chai');
import path = require('path'); import * as path from 'path';
const {expect} = chai; const {expect} = chai;
// to help WebStorm to handle the test cases // to help WebStorm to handle the test cases

View File

@ -8,9 +8,10 @@
"downlevelIteration": true, "downlevelIteration": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es2020", "target": "es2017",
"module": "commonjs", "module": "CommonJS",
"lib": [ "lib": [
"es2018",
"dom" "dom"
] ]
}, },