diff --git a/package-lock.json b/package-lock.json index e8491470..7bf50d0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -125,7 +125,7 @@ "zone.js": "0.11.5" }, "engines": { - "node": ">=14.14 <16.0" + "node": ">=16 <17.0" }, "optionalDependencies": { "ffmpeg-static": "5.0.0", diff --git a/src/backend/middlewares/user/UserRequestConstrainsMWs.ts b/src/backend/middlewares/user/UserRequestConstrainsMWs.ts index c87b60a7..338a9f63 100644 --- a/src/backend/middlewares/user/UserRequestConstrainsMWs.ts +++ b/src/backend/middlewares/user/UserRequestConstrainsMWs.ts @@ -1,4 +1,5 @@ import {NextFunction, Request, Response} from 'express'; +import { MoreThanOrEqual } from 'typeorm'; import {ErrorCodes, ErrorDTO} from '../../../common/entities/Error'; import {UserRoles} from '../../../common/entities/UserDTO'; import {ObjectManagers} from '../../model/ObjectManagers'; @@ -40,7 +41,7 @@ export class UserRequestConstrainsMWs { // TODO: fix it! try { - const result = await ObjectManagers.getInstance().UserManager.find({minRole: UserRoles.Admin}); + const result = await ObjectManagers.getInstance().UserManager.find({role: MoreThanOrEqual(UserRoles.Admin)}); if (result.length <= 1) { return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR)); } diff --git a/src/backend/model/database/sql/UserManager.ts b/src/backend/model/database/sql/UserManager.ts index ea6cdb36..088f5f91 100644 --- a/src/backend/model/database/sql/UserManager.ts +++ b/src/backend/model/database/sql/UserManager.ts @@ -25,9 +25,9 @@ export class UserManager implements IUserManager { } - public async find(filter: any): Promise { + public async find(filter: FindOptionsWhere): Promise { const connection = await SQLConnection.getConnection(); - return await connection.getRepository(UserEntity).find(filter); + return await connection.getRepository(UserEntity).findBy(filter); } public async createUser(user: UserDTO): Promise {