From 410caff427efe85f11353ceaca9026872fde2f32 Mon Sep 17 00:00:00 2001 From: Ihar Tsykala Date: Fri, 4 Oct 2024 16:26:57 +0500 Subject: [PATCH] fix:types of filters for findAndCount and count[3966] (#4210) Co-authored-by: Ihar --- common/src/database-modules/database-server.ts | 4 ++-- common/src/helpers/db-helper.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/database-modules/database-server.ts b/common/src/database-modules/database-server.ts index b6025007fc..b0e1ecd05a 100644 --- a/common/src/database-modules/database-server.ts +++ b/common/src/database-modules/database-server.ts @@ -238,7 +238,7 @@ export class DatabaseServer extends AbstractDatabaseServer { * @param filters * @param options */ - public async count(entityClass: new () => T, filters: FilterObject, options?: FindOptions): Promise { + public async count(entityClass: new () => T, filters: FilterQuery, options?: FindOptions): Promise { if (this.dryRun) { const _filters = { @@ -280,7 +280,7 @@ export class DatabaseServer extends AbstractDatabaseServer { * @param filters * @param options */ - public async findAndCount(entityClass: new () => T, filters: FilterObject | string | ObjectId, options?: unknown): Promise<[T[], number]> { + public async findAndCount(entityClass: new () => T, filters: FilterQuery | string | ObjectId, options?: unknown): Promise<[T[], number]> { return await new DataBaseHelper(entityClass).findAndCount(filters, options); } diff --git a/common/src/helpers/db-helper.ts b/common/src/helpers/db-helper.ts index 828e0aa308..1d3b926f1c 100644 --- a/common/src/helpers/db-helper.ts +++ b/common/src/helpers/db-helper.ts @@ -577,7 +577,7 @@ export class DataBaseHelper extends AbstractDataBaseHelper * @returns Entities and count */ @CreateRequestContext(() => DataBaseHelper.orm) - public async findAndCount(filters: FilterObject | string | ObjectId, options?: unknown): Promise<[T[], number]> { + public async findAndCount(filters: FilterQuery | string | ObjectId, options?: unknown): Promise<[T[], number]> { return await this._em.findAndCount(this.entityClass, filters, options); } @@ -588,7 +588,7 @@ export class DataBaseHelper extends AbstractDataBaseHelper * @returns Count */ @CreateRequestContext(() => DataBaseHelper.orm) - public async count(filters?: FilterObject | string | ObjectId, options?: FindOptions): Promise { + public async count(filters?: FilterQuery | string | ObjectId, options?: FindOptions): Promise { return await this._em.count(this.entityClass, filters, options); }