diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 19:33:08 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-01 19:33:08 +0900 |
| commit | d6b03c43eb818a5e13a8ad1ec69697e4600c5c2c (patch) | |
| tree | 20302f7974e7939f2e498b07bd11c86bea4f7e82 /src/api/endpoints/channels/create.ts | |
| parent | v2799 (diff) | |
| download | sharkey-d6b03c43eb818a5e13a8ad1ec69697e4600c5c2c.tar.gz sharkey-d6b03c43eb818a5e13a8ad1ec69697e4600c5c2c.tar.bz2 sharkey-d6b03c43eb818a5e13a8ad1ec69697e4600c5c2c.zip | |
Implement Channel Watching
Diffstat (limited to 'src/api/endpoints/channels/create.ts')
| -rw-r--r-- | src/api/endpoints/channels/create.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/api/endpoints/channels/create.ts b/src/api/endpoints/channels/create.ts index e0c0e0192a..a8d7c29dc1 100644 --- a/src/api/endpoints/channels/create.ts +++ b/src/api/endpoints/channels/create.ts @@ -3,6 +3,7 @@ */ import $ from 'cafy'; import Channel from '../../models/channel'; +import Watching from '../../models/channel-watching'; import serialize from '../../serializers/channel'; /** @@ -22,9 +23,17 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { created_at: new Date(), user_id: user._id, title: title, - index: 0 + index: 0, + watching_count: 1 }); // Response res(await serialize(channel)); + + // Create Watching + await Watching.insert({ + created_at: new Date(), + user_id: user._id, + channel_id: channel._id + }); }); |