Implement featured note API

This commit is contained in:
syuilo
2018-10-25 07:04:15 +09:00
parent 407467a236
commit 380f5a972c
4 changed files with 65 additions and 8 deletions

View File

@@ -36,12 +36,12 @@ export default async (user: IUser, note: INote, reaction: string) => new Promise
res();
const inc: {[key: string]: number} = {};
inc[`reactionCounts.${reaction}`] = 1;
// Increment reactions count
await Note.update({ _id: note._id }, {
$inc: inc
$inc: {
[`reactionCounts.${reaction}`]: 1,
score: 1
}
});
perUserReactionsChart.update(user, note);