Implement Channel Watching
This commit is contained in:
parent
2b3937d731
commit
d6b03c43eb
9 changed files with 244 additions and 27 deletions
|
|
@ -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
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue