summaryrefslogtreecommitdiff
path: root/src/api/endpoints/aggregation/posts.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-28 16:39:14 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-28 16:39:14 +0900
commit3d5cdb8d2d60932caf1d29b0581c7d6243e06e37 (patch)
tree9c29d1062b08378d4c4cafe5976793616d45bc01 /src/api/endpoints/aggregation/posts.ts
parentwip (diff)
downloadsharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.gz
sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.tar.bz2
sharkey-3d5cdb8d2d60932caf1d29b0581c7d6243e06e37.zip
wip
Diffstat (limited to 'src/api/endpoints/aggregation/posts.ts')
-rw-r--r--src/api/endpoints/aggregation/posts.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/api/endpoints/aggregation/posts.ts b/src/api/endpoints/aggregation/posts.ts
index 9d8bccbdb2..67d2619640 100644
--- a/src/api/endpoints/aggregation/posts.ts
+++ b/src/api/endpoints/aggregation/posts.ts
@@ -18,23 +18,23 @@ module.exports = params => new Promise(async (res, rej) => {
const datas = await Post
.aggregate([
{ $project: {
- repost_id: '$repost_id',
- reply_id: '$reply_id',
- created_at: { $add: ['$created_at', 9 * 60 * 60 * 1000] } // Convert into JST
+ repostId: '$repostId',
+ replyId: '$replyId',
+ createdAt: { $add: ['$createdAt', 9 * 60 * 60 * 1000] } // Convert into JST
}},
{ $project: {
date: {
- year: { $year: '$created_at' },
- month: { $month: '$created_at' },
- day: { $dayOfMonth: '$created_at' }
+ year: { $year: '$createdAt' },
+ month: { $month: '$createdAt' },
+ day: { $dayOfMonth: '$createdAt' }
},
type: {
$cond: {
- if: { $ne: ['$repost_id', null] },
+ if: { $ne: ['$repostId', null] },
then: 'repost',
else: {
$cond: {
- if: { $ne: ['$reply_id', null] },
+ if: { $ne: ['$replyId', null] },
then: 'reply',
else: 'post'
}