diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-04 09:39:25 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-04 09:39:25 +0900 |
| commit | d7c94de07e17e31513780ceabf824a3d0760ff80 (patch) | |
| tree | 890e64439127e0f118a6a0e041c7f14ee2f9b891 /src/api | |
| parent | :art: (diff) | |
| download | sharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.tar.gz sharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.tar.bz2 sharkey-d7c94de07e17e31513780ceabf824a3d0760ff80.zip | |
#172
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/endpoints/posts/create.ts | 5 | ||||
| -rw-r--r-- | src/api/models/post.ts | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/api/endpoints/posts/create.ts b/src/api/endpoints/posts/create.ts index 075e1ac9f0..57f98fa811 100644 --- a/src/api/endpoints/posts/create.ts +++ b/src/api/endpoints/posts/create.ts @@ -31,6 +31,10 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$; if (textErr) return rej('invalid text'); + // Get 'via_mobile' parameter + const [viaMobile = false, viaMobileErr] = $(params.via_mobile).optional.boolean().$; + if (viaMobileErr) return rej('invalid via_mobile'); + // Get 'tags' parameter const [tags = [], tagsErr] = $(params.tags).optional.array('string').unique().eachQ(t => t.range(1, 32)).$; if (tagsErr) return rej('invalid tags'); @@ -239,6 +243,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => { tags: tags, user_id: user._id, app_id: app ? app._id : null, + via_mobile: viaMobile, // 以下非正規化データ _reply: reply ? { user_id: reply.user_id } : undefined, diff --git a/src/api/models/post.ts b/src/api/models/post.ts index 0bbacebf66..edb69e0c15 100644 --- a/src/api/models/post.ts +++ b/src/api/models/post.ts @@ -31,6 +31,7 @@ export type IPost = { app_id: mongo.ObjectID; category: string; is_category_verified: boolean; + via_mobile: boolean; }; /** |