From 50b354207462d2fba453fb72034bdb6276ab72e9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 14 Apr 2019 20:28:57 +0900 Subject: [PATCH] inc/dec score --- src/services/note/reaction/create.ts | 3 ++- src/services/note/reaction/delete.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index 6db210ea6..0e8bcebdb 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -49,7 +49,8 @@ export default async (user: User, note: Note, reaction?: string) => { }) .where('id = :id', { id: note.id }) .execute(); - // v11 inc score + + Notes.increment({ id: note.id }, 'score', 1); perUserReactionsChart.update(user, note); diff --git a/src/services/note/reaction/delete.ts b/src/services/note/reaction/delete.ts index 355e1c546..6e9611ca5 100644 --- a/src/services/note/reaction/delete.ts +++ b/src/services/note/reaction/delete.ts @@ -30,7 +30,8 @@ export default async (user: User, note: Note) => { }) .where('id = :id', { id: note.id }) .execute(); - // v11 dec score + + Notes.decrement({ id: note.id }, 'score', 1); publishNoteStream(note.id, 'unreacted', { reaction: exist.reaction,