2018-04-27 18:54:36 +02:00
|
|
|
const db = require('../../../../models');
|
2018-04-27 08:42:22 +02:00
|
|
|
|
|
|
|
const checkChannelAvailability = (name) => {
|
|
|
|
return db.Channel
|
|
|
|
.findAll({
|
2018-05-04 00:47:58 +02:00
|
|
|
where: {
|
|
|
|
channelName: name,
|
|
|
|
},
|
2018-04-27 08:42:22 +02:00
|
|
|
})
|
|
|
|
.then(result => {
|
2018-05-04 00:47:58 +02:00
|
|
|
return (result.length <= 0);
|
2018-04-27 08:42:22 +02:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
throw error;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = checkChannelAvailability;
|