From f28b4e7c99dd4eb1c406918dc2546064059b88a0 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 May 2024 11:51:15 -0500 Subject: [PATCH] fix(server): sync issue when delete remotes assets (#9479) --- server/src/repositories/audit.repository.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/repositories/audit.repository.ts b/server/src/repositories/audit.repository.ts index 6cf5b76e6e..deb0d0f6f1 100644 --- a/server/src/repositories/audit.repository.ts +++ b/server/src/repositories/audit.repository.ts @@ -10,8 +10,8 @@ import { In, LessThan, MoreThan, Repository } from 'typeorm'; export class AuditRepository implements IAuditRepository { constructor(@InjectRepository(AuditEntity) private repository: Repository) {} - getAfter(since: Date, options: AuditSearch): Promise { - return this.repository + async getAfter(since: Date, options: AuditSearch): Promise { + const records = await this.repository .createQueryBuilder('audit') .where({ createdAt: MoreThan(since), @@ -22,7 +22,9 @@ export class AuditRepository implements IAuditRepository { .distinctOn(['audit.entityId', 'audit.entityType']) .orderBy('audit.entityId, audit.entityType, audit.createdAt', 'DESC') .select('audit.entityId') - .getRawMany(); + .getMany(); + + return records.map((r) => r.entityId); } async removeBefore(before: Date): Promise {