diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-05 15:50:52 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-05 15:50:52 +0900 |
| commit | fc15249aa43471e73eb9dda46e1807084f4d2cd3 (patch) | |
| tree | 31f9f5e43581399d20c1e5d3600eb94fd56c013b /src/api/post/create.ts | |
| parent | wip (diff) | |
| download | sharkey-fc15249aa43471e73eb9dda46e1807084f4d2cd3.tar.gz sharkey-fc15249aa43471e73eb9dda46e1807084f4d2cd3.tar.bz2 sharkey-fc15249aa43471e73eb9dda46e1807084f4d2cd3.zip | |
wip
Diffstat (limited to 'src/api/post/create.ts')
| -rw-r--r-- | src/api/post/create.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/api/post/create.ts b/src/api/post/create.ts index 36819ec2b8..5495117538 100644 --- a/src/api/post/create.ts +++ b/src/api/post/create.ts @@ -54,8 +54,7 @@ export default async (user: IUser, content: { }); } - // 投稿を作成 - const post = await Post.insert({ + const data: any = { createdAt: content.createdAt, mediaIds: content.media ? content.media.map(file => file._id) : [], replyId: content.reply ? content.reply._id : null, @@ -68,14 +67,18 @@ export default async (user: IUser, content: { userId: user._id, viaMobile: content.viaMobile, geo: content.geo || null, - uri: content.uri, appId: content.app ? content.app._id : null, visibility: content.visibility, // 以下非正規化データ _reply: content.reply ? { userId: content.reply.userId } : null, _repost: content.repost ? { userId: content.repost.userId } : null, - }); + }; + + if (content.uri != null) data.uri = content.uri; + + // 投稿を作成 + const post = await Post.insert(data); res(post); |