From f4588f3907c676389603944bd716a239c3444c53 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 7 Apr 2023 10:07:41 +0900 Subject: [PATCH] perf(backend): reduce db query --- packages/backend/src/core/entities/NoteEntityService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index f23e0f38e..26debd6ad 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -288,7 +288,7 @@ export class NoteEntityService implements OnModuleInit { }, options); const meId = me ? me.id : null; - const note = typeof src === 'object' ? src : await this.notesRepository.findOneByOrFail({ id: src }); + const note = typeof src === 'object' ? src : await this.notesRepository.findOneOrFail({ where: { id: src }, relations: ['user'] }); const host = note.userHost; let text = note.text;