diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-05-24 16:29:00 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-05-24 16:29:00 +0900 |
| commit | 39edc11ad8b51a012155f086473b42be66fe2fad (patch) | |
| tree | 1372ebeb9bb300310f619ae50b0a3909a000ec1c /src/api/endpoints/aggregation/posts | |
| parent | Add info to error message (diff) | |
| download | sharkey-39edc11ad8b51a012155f086473b42be66fe2fad.tar.gz sharkey-39edc11ad8b51a012155f086473b42be66fe2fad.tar.bz2 sharkey-39edc11ad8b51a012155f086473b42be66fe2fad.zip | |
Fix iroiro
Diffstat (limited to 'src/api/endpoints/aggregation/posts')
| -rw-r--r-- | src/api/endpoints/aggregation/posts/reaction.ts (renamed from src/api/endpoints/aggregation/posts/like.ts) | 6 | ||||
| -rw-r--r-- | src/api/endpoints/aggregation/posts/reactions.ts (renamed from src/api/endpoints/aggregation/posts/likes.ts) | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/api/endpoints/aggregation/posts/like.ts b/src/api/endpoints/aggregation/posts/reaction.ts index 3f44413fe8..e4ca680c33 100644 --- a/src/api/endpoints/aggregation/posts/like.ts +++ b/src/api/endpoints/aggregation/posts/reaction.ts @@ -3,10 +3,10 @@ */ import $ from 'cafy'; import Post from '../../../models/post'; -import Like from '../../../models/like'; +import Reaction from '../../../models/post-reaction'; /** - * Aggregate like of a post + * Aggregate reaction of a post * * @param {any} params * @return {Promise<any>} @@ -25,7 +25,7 @@ module.exports = (params) => new Promise(async (res, rej) => { return rej('post not found'); } - const datas = await Like + const datas = await Reaction .aggregate([ { $match: { post_id: post._id } }, { $project: { diff --git a/src/api/endpoints/aggregation/posts/likes.ts b/src/api/endpoints/aggregation/posts/reactions.ts index 5031edbffb..2cd4588ae1 100644 --- a/src/api/endpoints/aggregation/posts/likes.ts +++ b/src/api/endpoints/aggregation/posts/reactions.ts @@ -3,10 +3,10 @@ */ import $ from 'cafy'; import Post from '../../../models/post'; -import Like from '../../../models/like'; +import Reaction from '../../../models/post-reaction'; /** - * Aggregate likes of a post + * Aggregate reactions of a post * * @param {any} params * @return {Promise<any>} @@ -27,7 +27,7 @@ module.exports = (params) => new Promise(async (res, rej) => { const startTime = new Date(new Date().setMonth(new Date().getMonth() - 1)); - const likes = await Like + const reactions = await Reaction .find({ post_id: post._id, $or: [ @@ -51,8 +51,8 @@ module.exports = (params) => new Promise(async (res, rej) => { day = new Date(day.setHours(23)); // day = day.getTime(); - const count = likes.filter(l => - l.created_at < day && (l.deleted_at == null || l.deleted_at > day) + const count = reactions.filter(r => + r.created_at < day && (r.deleted_at == null || r.deleted_at > day) ).length; graph.push({ |