-function checkVideoChannelExists (id: string, res: express.Response, callback: () => void) {
- let promise: Promise<VideoChannelInstance>
- if (validator.isInt(id)) {
- promise = db.VideoChannel.loadAndPopulateAuthor(+id)
- } else { // UUID
- promise = db.VideoChannel.loadByUUIDAndPopulateAuthor(id)
- }
+async function doesLocalVideoChannelNameExist (name: string, res: express.Response) {
+ const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
+
+ return processVideoChannelExist(videoChannel, res)
+}
+
+async function doesVideoChannelIdExist (id: number, res: express.Response) {
+ const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id)