diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-03 06:48:26 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-03 06:48:26 +0900 |
| commit | 6e181ee0f1ca2ecd0fdf3a78654607ef112f2a6a (patch) | |
| tree | d9319e37433f57c70cdf9e66b57b525fd7bfc881 /src/api/endpoints/posts/show.js | |
| parent | wip (diff) | |
| download | misskey-6e181ee0f1ca2ecd0fdf3a78654607ef112f2a6a.tar.gz misskey-6e181ee0f1ca2ecd0fdf3a78654607ef112f2a6a.tar.bz2 misskey-6e181ee0f1ca2ecd0fdf3a78654607ef112f2a6a.zip | |
wip
Diffstat (limited to 'src/api/endpoints/posts/show.js')
| -rw-r--r-- | src/api/endpoints/posts/show.js | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/api/endpoints/posts/show.js b/src/api/endpoints/posts/show.js deleted file mode 100644 index 4938199cdb..0000000000 --- a/src/api/endpoints/posts/show.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -/** - * Module dependencies - */ -import * as mongo from 'mongodb'; -import Post from '../../models/post'; -import serialize from '../../serializers/post'; - -/** - * Show a post - * - * @param {any} params - * @param {any} user - * @return {Promise<any>} - */ -module.exports = (params, user) => - new Promise(async (res, rej) => -{ - // Get 'post_id' parameter - const postId = params.post_id; - if (postId === undefined || postId === null) { - return rej('post_id is required'); - } - - // Validate id - if (!mongo.ObjectID.isValid(postId)) { - return rej('incorrect post_id'); - } - - // Get post - const post = await Post.findOne({ - _id: new mongo.ObjectID(postId) - }); - - if (post === null) { - return rej('post not found'); - } - - // Serialize - res(await serialize(post, user, { - detail: true - })); -}); |