diff --git a/backend/src/typeorm/entity/UserTransaction.ts b/backend/src/typeorm/entity/UserTransaction.ts index 2f5bd69fc..7e24b66b0 100644 --- a/backend/src/typeorm/entity/UserTransaction.ts +++ b/backend/src/typeorm/entity/UserTransaction.ts @@ -19,18 +19,4 @@ export class UserTransaction extends BaseEntity { @Column({ name: 'balance_date', type: 'timestamp' }) balanceDate: Date - - static findByUserPaged( - userId: number, - limit: number, - offset: number, - order: 'ASC' | 'DESC', - ): Promise<[UserTransaction[], number]> { - return this.createQueryBuilder('userTransaction') - .where('userTransaction.userId = :userId', { userId }) - .orderBy('userTransaction.balanceDate', order) - .limit(limit) - .offset(offset) - .getManyAndCount() - } } diff --git a/backend/src/typeorm/repository/UserTransaction.ts b/backend/src/typeorm/repository/UserTransaction.ts new file mode 100644 index 000000000..7efd8f12b --- /dev/null +++ b/backend/src/typeorm/repository/UserTransaction.ts @@ -0,0 +1,19 @@ +import { EntityRepository, Repository } from 'typeorm' +import { UserTransaction } from '../entity/UserTransaction' + +@EntityRepository(UserTransaction) +export class UserTransactionRepository extends Repository { + findByUserPaged( + userId: number, + limit: number, + offset: number, + order: 'ASC' | 'DESC', + ): Promise<[UserTransaction[], number]> { + return this.createQueryBuilder('userTransaction') + .where('userTransaction.userId = :userId', { userId }) + .orderBy('userTransaction.balanceDate', order) + .limit(limit) + .offset(offset) + .getManyAndCount() + } +}