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

19 lines
341 B
JavaScript
Raw Normal View History

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