perf(server): reduce db query when get notifications

This commit is contained in:
syuilo 2022-03-26 18:22:55 +09:00
parent 3cac8e0f6f
commit 475cee9029

View file

@ -70,6 +70,8 @@ export default define(meta, paramDef, async (ps, user) => {
.andWhere(`notification.notifieeId = :meId`, { meId: user.id }) .andWhere(`notification.notifieeId = :meId`, { meId: user.id })
.leftJoinAndSelect('notification.notifier', 'notifier') .leftJoinAndSelect('notification.notifier', 'notifier')
.leftJoinAndSelect('notification.note', 'note') .leftJoinAndSelect('notification.note', 'note')
.leftJoinAndSelect('notifier.avatar', 'notifierAvatar')
.leftJoinAndSelect('notifier.banner', 'notifierBanner')
.leftJoinAndSelect('note.user', 'user') .leftJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('user.avatar', 'avatar') .leftJoinAndSelect('user.avatar', 'avatar')
.leftJoinAndSelect('user.banner', 'banner') .leftJoinAndSelect('user.banner', 'banner')