Skip to content

Commit

Permalink
fix:types of filters for findAndCount and count[3966] (#4210)
Browse files Browse the repository at this point in the history
Co-authored-by: Ihar <[email protected]>
  • Loading branch information
ihar-tsykala and Ihar authored Oct 4, 2024
1 parent fb13eca commit 410caff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions common/src/database-modules/database-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class DatabaseServer extends AbstractDatabaseServer {
* @param filters
* @param options
*/
public async count<T extends BaseEntity>(entityClass: new () => T, filters: FilterObject<T>, options?: FindOptions<unknown>): Promise<number> {
public async count<T extends BaseEntity>(entityClass: new () => T, filters: FilterQuery<T>, options?: FindOptions<unknown>): Promise<number> {
if (this.dryRun) {

const _filters = {
Expand Down Expand Up @@ -280,7 +280,7 @@ export class DatabaseServer extends AbstractDatabaseServer {
* @param filters
* @param options
*/
public async findAndCount<T extends BaseEntity>(entityClass: new () => T, filters: FilterObject<T> | string | ObjectId, options?: unknown): Promise<[T[], number]> {
public async findAndCount<T extends BaseEntity>(entityClass: new () => T, filters: FilterQuery<T> | string | ObjectId, options?: unknown): Promise<[T[], number]> {
return await new DataBaseHelper(entityClass).findAndCount(filters, options);
}

Expand Down
4 changes: 2 additions & 2 deletions common/src/helpers/db-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export class DataBaseHelper<T extends BaseEntity> extends AbstractDataBaseHelper
* @returns Entities and count
*/
@CreateRequestContext(() => DataBaseHelper.orm)
public async findAndCount(filters: FilterObject<T> | string | ObjectId, options?: unknown): Promise<[T[], number]> {
public async findAndCount(filters: FilterQuery<T> | string | ObjectId, options?: unknown): Promise<[T[], number]> {
return await this._em.findAndCount(this.entityClass, filters, options);
}

Expand All @@ -588,7 +588,7 @@ export class DataBaseHelper<T extends BaseEntity> extends AbstractDataBaseHelper
* @returns Count
*/
@CreateRequestContext(() => DataBaseHelper.orm)
public async count(filters?: FilterObject<T> | string | ObjectId, options?: FindOptions<unknown>): Promise<number> {
public async count(filters?: FilterQuery<T> | string | ObjectId, options?: FindOptions<unknown>): Promise<number> {
return await this._em.count(this.entityClass, filters, options);
}

Expand Down

0 comments on commit 410caff

Please sign in to comment.