summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-02 23:19:07 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-02 23:19:07 +0900
commit5ce6fa67d212823be43c796e8632b721ede065bb (patch)
treecb188b5e97741625feb095bfb577d46b91cbacc2 /src/server
parentMerge pull request #1374 from akihikodaki/log (diff)
downloadsharkey-5ce6fa67d212823be43c796e8632b721ede065bb.tar.gz
sharkey-5ce6fa67d212823be43c796e8632b721ede065bb.tar.bz2
sharkey-5ce6fa67d212823be43c796e8632b721ede065bb.zip
Make migration scripts
and use createdAt instead of _id
Diffstat (limited to 'src/server')
-rw-r--r--src/server/api/endpoints/aggregation/users/followers.ts4
-rw-r--r--src/server/api/endpoints/aggregation/users/following.ts4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/server/api/endpoints/aggregation/users/followers.ts b/src/server/api/endpoints/aggregation/users/followers.ts
index 580d31a3f2..f9a5e8dca8 100644
--- a/src/server/api/endpoints/aggregation/users/followers.ts
+++ b/src/server/api/endpoints/aggregation/users/followers.ts
@@ -42,10 +42,10 @@ module.exports = (params) => new Promise(async (res, rej) => {
for (let i = 0; i < 30; i++) {
graph.push(FollowedLog.findOne({
- _id: { $lt: ObjectID.createFromTime(cursorTime / 1000) },
+ createdAt: { $lt: new Date(cursorTime / 1000) },
userId: user._id
}, {
- sort: { _id: -1 },
+ sort: { createdAt: -1 },
}).then(log => {
cursorDate = new Date(today.getTime());
cursorTime = cursorDate.setDate(today.getDate() - i);
diff --git a/src/server/api/endpoints/aggregation/users/following.ts b/src/server/api/endpoints/aggregation/users/following.ts
index 3ac0e3a539..b30b1282ba 100644
--- a/src/server/api/endpoints/aggregation/users/following.ts
+++ b/src/server/api/endpoints/aggregation/users/following.ts
@@ -42,10 +42,10 @@ module.exports = (params) => new Promise(async (res, rej) => {
for (let i = 0; i < 30; i++) {
graph.push(FollowingLog.findOne({
- _id: { $lt: ObjectID.createFromTime(cursorTime / 1000) },
+ createdAt: { $lt: new Date(cursorTime / 1000) },
userId: user._id
}, {
- sort: { _id: -1 },
+ sort: { createdAt: -1 },
}).then(log => {
cursorDate = new Date(today.getTime());
cursorTime = cursorDate.setDate(today.getDate() - i);