Clean up
This commit is contained in:
parent
ddad9da1c1
commit
e6eb1b2ae1
36 changed files with 5 additions and 1626 deletions
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
|
||||
import Channel, { IChannel, pack } from '../../../../models/channel';
|
||||
|
||||
/**
|
||||
* Show a channel
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
|
||||
if (channelIdErr) return rej('invalid channelId param');
|
||||
|
||||
// Fetch channel
|
||||
const channel: IChannel = await Channel.findOne({
|
||||
_id: channelId
|
||||
});
|
||||
|
||||
if (channel === null) {
|
||||
return rej('channel not found');
|
||||
}
|
||||
|
||||
// Serialize
|
||||
res(await pack(channel, user));
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue