spee.ch/server/controllers/api/channel/availability/checkChannelAvailability.js

19 lines
341 B
JavaScript
Raw Normal View History

2018-04-27 09:54:36 -07:00
const db = require('../../../../models');
const checkChannelAvailability = (name) => {
return db.Channel
.findAll({
2018-05-03 15:47:58 -07:00
where: {
channelName: name,
},
})
.then(result => {
2018-05-03 15:47:58 -07:00
return (result.length <= 0);
})
.catch(error => {
throw error;
});
};
module.exports = checkChannelAvailability;