From ccea18001c53eab4868132be08442cecb16df899 Mon Sep 17 00:00:00 2001 From: mawahl Date: Tue, 7 Nov 2023 12:04:22 +0100 Subject: [PATCH] add sort for users to be migrated and clear cache --- apps/server/src/modules/account/repo/account.repo.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/server/src/modules/account/repo/account.repo.ts b/apps/server/src/modules/account/repo/account.repo.ts index fb68f0a759b..d1872d1ca67 100644 --- a/apps/server/src/modules/account/repo/account.repo.ts +++ b/apps/server/src/modules/account/repo/account.repo.ts @@ -1,7 +1,7 @@ import { AnyEntity, EntityName, Primary } from '@mikro-orm/core'; import { ObjectId } from '@mikro-orm/mongodb'; import { Injectable } from '@nestjs/common'; -import { EntityId } from '@shared/domain'; +import { EntityId, SortOrder } from '@shared/domain'; import { Account } from '@shared/domain/entity/account.entity'; import { BaseRepo } from '@shared/repo/base.repo'; @@ -71,7 +71,9 @@ export class AccountRepo extends BaseRepo { * @deprecated For migration purpose only */ async findMany(offset = 0, limit = 100): Promise { - return this._em.find(this.entityName, {}, { offset, limit }); + const result = await this._em.find(this.entityName, {}, { offset, limit, orderBy: { id: SortOrder.asc } }); + this._em.clear(); + return result; } private async searchByUsername(