X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideo-channel.ts;h=c13aed4dc80d2f5e2b72ef6592cff5533ec24184;hb=df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa;hp=534cc8d7b19f67341eaf17903dae05b1492c6118;hpb=07b1a18aa678d260009a93e36606c5c5f585723d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 534cc8d7b..c13aed4dc 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -33,6 +33,7 @@ import { resetSequelizeInstance } from '../../helpers/database-utils' import { UserModel } from '../../models/account/user' import { JobQueue } from '../../lib/job-queue' import { VideoPlaylistModel } from '../../models/video/video-playlist' +import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' const auditLogger = auditLoggerFactory('channels') const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) @@ -85,6 +86,7 @@ videoChannelRouter.get('/:nameWithHost/video-playlists', videoPlaylistsSortValidator, setDefaultSort, setDefaultPagination, + commonVideoPlaylistFiltersValidator, asyncMiddleware(listVideoChannelPlaylists) ) @@ -197,6 +199,8 @@ async function removeVideoChannel (req: express.Request, res: express.Response) const videoChannelInstance: VideoChannelModel = res.locals.videoChannel await sequelizeTypescript.transaction(async t => { + await VideoPlaylistModel.resetPlaylistsOfChannel(videoChannelInstance.id, t) + await videoChannelInstance.destroy({ transaction: t }) auditLogger.delete(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannelInstance.toFormattedJSON())) @@ -225,7 +229,8 @@ async function listVideoChannelPlaylists (req: express.Request, res: express.Res start: req.query.start, count: req.query.count, sort: req.query.sort, - videoChannelId: res.locals.videoChannel.id + videoChannelId: res.locals.videoChannel.id, + type: req.query.playlistType }) return res.json(getFormattedObjects(resultList.data, resultList.total))