diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-02 16:33:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-06 11:19:16 +0200 |
commit | 299474e8279675adb6c5ce140e7e39c6f3439453 (patch) | |
tree | 32962c4a6878e4f4268e10eb0fbb9db670013ad3 /server/controllers/api | |
parent | ce32426be941164d041526e4748b4c83cdc6bf1c (diff) | |
download | PeerTube-299474e8279675adb6c5ce140e7e39c6f3439453.tar.gz PeerTube-299474e8279675adb6c5ce140e7e39c6f3439453.tar.zst PeerTube-299474e8279675adb6c5ce140e7e39c6f3439453.zip |
Add ability to remove a video import
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/videos/import.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 9761cdbcf..680d8665f 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -41,7 +41,7 @@ videoImportsRouter.post('/imports', | |||
41 | 41 | ||
42 | videoImportsRouter.delete('/imports/:id', | 42 | videoImportsRouter.delete('/imports/:id', |
43 | authenticate, | 43 | authenticate, |
44 | videoImportDeleteValidator, | 44 | asyncMiddleware(videoImportDeleteValidator), |
45 | asyncRetryTransactionMiddleware(deleteVideoImport) | 45 | asyncRetryTransactionMiddleware(deleteVideoImport) |
46 | ) | 46 | ) |
47 | 47 | ||
@@ -147,5 +147,13 @@ async function addVideoImport (req: express.Request, res: express.Response) { | |||
147 | } | 147 | } |
148 | 148 | ||
149 | async function deleteVideoImport (req: express.Request, res: express.Response) { | 149 | async function deleteVideoImport (req: express.Request, res: express.Response) { |
150 | // TODO: delete video import | 150 | await sequelizeTypescript.transaction(async t => { |
151 | const videoImport = res.locals.videoImport | ||
152 | const video = videoImport.Video | ||
153 | |||
154 | await videoImport.destroy({ transaction: t }) | ||
155 | await video.destroy({ transaction: t }) | ||
156 | }) | ||
157 | |||
158 | return res.status(204).end() | ||
151 | } | 159 | } |