summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-28 15:59:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-28 15:59:34 +0900
commit65069d5fdb9af3214d62fcd48f140c9e735fa892 (patch)
treeb4b372d1e3bda73612151d0dca68307e03c70e5b
parentwip (diff)
downloadmisskey-65069d5fdb9af3214d62fcd48f140c9e735fa892.tar.gz
misskey-65069d5fdb9af3214d62fcd48f140c9e735fa892.tar.bz2
misskey-65069d5fdb9af3214d62fcd48f140c9e735fa892.zip
wip
-rw-r--r--src/api/models/post-reaction.ts8
-rw-r--r--src/api/models/post-watching.ts11
-rw-r--r--tools/migration/shell.camel-case.js9
3 files changed, 24 insertions, 4 deletions
diff --git a/src/api/models/post-reaction.ts b/src/api/models/post-reaction.ts
index 639a70e006..f581f01535 100644
--- a/src/api/models/post-reaction.ts
+++ b/src/api/models/post-reaction.ts
@@ -4,13 +4,15 @@ import db from '../../db/mongodb';
import Reaction from './post-reaction';
import { pack as packUser } from './user';
-const PostReaction = db.get<IPostReaction>('post_reactions');
+const PostReaction = db.get<IPostReaction>('postReactions');
export default PostReaction;
export interface IPostReaction {
_id: mongo.ObjectID;
- created_at: Date;
- deleted_at: Date;
+ createdAt: Date;
+ deletedAt: Date;
+ postId: mongo.ObjectID;
+ userId: mongo.ObjectID;
reaction: string;
}
diff --git a/src/api/models/post-watching.ts b/src/api/models/post-watching.ts
index 41d37e2703..907909a50f 100644
--- a/src/api/models/post-watching.ts
+++ b/src/api/models/post-watching.ts
@@ -1,3 +1,12 @@
+import * as mongo from 'mongodb';
import db from '../../db/mongodb';
-export default db.get('post_watching') as any; // fuck type definition
+const PostWatching = db.get<IPostWatching>('postWatching');
+export default PostWatching;
+
+export interface IPostWatching {
+ _id: mongo.ObjectID;
+ createdAt: Date;
+ userId: mongo.ObjectID;
+ postId: mongo.ObjectID;
+}
diff --git a/tools/migration/shell.camel-case.js b/tools/migration/shell.camel-case.js
index 6045dfa00c..2a5456b4d0 100644
--- a/tools/migration/shell.camel-case.js
+++ b/tools/migration/shell.camel-case.js
@@ -147,3 +147,12 @@ db.pollVotes.update({}, {
post_id: 'postId'
}
}, false, true);
+
+db.post_reactions.renameCollection('postReactions');
+db.postReactions.update({}, {
+ $rename: {
+ created_at: 'createdAt',
+ user_id: 'userId',
+ post_id: 'postId'
+ }
+}, false, true);