From bed17efd1b40e05e49b4de50c118f2acf804b95e Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 28 Mar 2018 16:04:44 +0900 Subject: [PATCH] wip --- src/api/models/post.ts | 18 ++++++++---------- tools/migration/shell.camel-case.js | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/api/models/post.ts b/src/api/models/post.ts index c37c8371c0..fc44256516 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -20,18 +20,16 @@ export function isValidText(text: string): boolean { export type IPost = { _id: mongo.ObjectID; - channel_id: mongo.ObjectID; - created_at: Date; - media_ids: mongo.ObjectID[]; - reply_id: mongo.ObjectID; - repost_id: mongo.ObjectID; + channelId: mongo.ObjectID; + createdAt: Date; + mediaIds: mongo.ObjectID[]; + replyId: mongo.ObjectID; + repostId: mongo.ObjectID; poll: any; // todo text: string; - user_id: mongo.ObjectID; - app_id: mongo.ObjectID; - category: string; - is_category_verified: boolean; - via_mobile: boolean; + userId: mongo.ObjectID; + appId: mongo.ObjectID; + viaMobile: boolean; geo: { latitude: number; longitude: number; diff --git a/tools/migration/shell.camel-case.js b/tools/migration/shell.camel-case.js index 2a5456b4d0..326d0a1b0f 100644 --- a/tools/migration/shell.camel-case.js +++ b/tools/migration/shell.camel-case.js @@ -156,3 +156,25 @@ db.postReactions.update({}, { post_id: 'postId' } }, false, true); + +db.post_watching.renameCollection('postWatching'); +db.postWatching.update({}, { + $rename: { + created_at: 'createdAt', + user_id: 'userId', + post_id: 'postId' + } +}, false, true); + +db.posts.update({}, { + $rename: { + created_at: 'createdAt', + channel_id: 'channelId', + user_id: 'userId', + app_id: 'appId', + media_ids: 'mediaIds', + reply_id: 'replyId', + repost_id: 'repostId', + via_mobile: 'viaMobile' + } +}, false, true);