1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add ability to remove a video import

This commit is contained in:
Chocobozzz 2018-08-02 16:33:29 +02:00
parent ce32426be9
commit 299474e827
5 changed files with 47 additions and 7 deletions

View file

@ -41,7 +41,7 @@ videoImportsRouter.post('/imports',
videoImportsRouter.delete('/imports/:id',
authenticate,
videoImportDeleteValidator,
asyncMiddleware(videoImportDeleteValidator),
asyncRetryTransactionMiddleware(deleteVideoImport)
)
@ -147,5 +147,13 @@ async function addVideoImport (req: express.Request, res: express.Response) {
}
async function deleteVideoImport (req: express.Request, res: express.Response) {
// TODO: delete video import
await sequelizeTypescript.transaction(async t => {
const videoImport = res.locals.videoImport
const video = videoImport.Video
await videoImport.destroy({ transaction: t })
await video.destroy({ transaction: t })
})
return res.status(204).end()
}