Skip to content

Commit

Permalink
BC-4887 add sort for users to be migrated and clear cache (#4524)
Browse files Browse the repository at this point in the history
  • Loading branch information
WahlMartin authored Nov 7, 2023
1 parent 84ececb commit cbf3940
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/server/src/modules/account/repo/account.repo.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -71,7 +71,9 @@ export class AccountRepo extends BaseRepo<Account> {
* @deprecated For migration purpose only
*/
async findMany(offset = 0, limit = 100): Promise<Account[]> {
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(
Expand Down

0 comments on commit cbf3940

Please sign in to comment.