diff options
| author | Kana <[email protected]> | 2021-01-08 19:48:25 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-01-08 19:48:25 +0900 |
| commit | 3cfb2721ce64ab94fdbc9c97b54602acc3c654be (patch) | |
| tree | b427becf78c51081e58f1b2af98b2662f7626a39 /src/api/routes/files | |
| parent | Merge pull request #248 from WeebDev/feature/stats-dashboard (diff) | |
| parent | fix: pg driver doesn't return anything without .returning() (diff) | |
| download | host.fuwn.me-3cfb2721ce64ab94fdbc9c97b54602acc3c654be.tar.xz host.fuwn.me-3cfb2721ce64ab94fdbc9c97b54602acc3c654be.zip | |
Merge pull request #250 from Zephyrrus/feature/system_status_page
Feature/system status page
Diffstat (limited to 'src/api/routes/files')
| -rw-r--r-- | src/api/routes/files/albumAddPOST.js | 2 | ||||
| -rw-r--r-- | src/api/routes/files/albumDelPOST.js | 3 | ||||
| -rw-r--r-- | src/api/routes/files/tagAddBatchPOST.js | 2 | ||||
| -rw-r--r-- | src/api/routes/files/tagAddPOST.js | 2 | ||||
| -rw-r--r-- | src/api/routes/files/tagDelPOST.js | 3 |
5 files changed, 7 insertions, 5 deletions
diff --git a/src/api/routes/files/albumAddPOST.js b/src/api/routes/files/albumAddPOST.js index 7b8acf7..645a6be 100644 --- a/src/api/routes/files/albumAddPOST.js +++ b/src/api/routes/files/albumAddPOST.js @@ -18,7 +18,7 @@ class albumAddPOST extends Route { try { await db.table('albumsFiles') - .insert({ fileId, albumId }); + .insert({ fileId, albumId }).wasMutated(); } catch (error) { return super.error(res, error); } diff --git a/src/api/routes/files/albumDelPOST.js b/src/api/routes/files/albumDelPOST.js index 8304163..63da791 100644 --- a/src/api/routes/files/albumDelPOST.js +++ b/src/api/routes/files/albumDelPOST.js @@ -19,7 +19,8 @@ class albumDelPOST extends Route { try { await db.table('albumsFiles') .where({ fileId, albumId }) - .delete(); + .delete() + .wasMutated(); } catch (error) { return super.error(res, error); } diff --git a/src/api/routes/files/tagAddBatchPOST.js b/src/api/routes/files/tagAddBatchPOST.js index 679945d..de41d8f 100644 --- a/src/api/routes/files/tagAddBatchPOST.js +++ b/src/api/routes/files/tagAddBatchPOST.js @@ -20,7 +20,7 @@ class tagAddBatchPOST extends Route { try { const tag = await db.table('tags').where({ name: tagName, userId: user.id }).first(); if (!tag) throw new Error('Tag doesn\'t exist in the database'); - await db.table('fileTags').insert({ fileId, tagId: tag.id }); + await db.table('fileTags').insert({ fileId, tagId: tag.id }).wasMutated(); addedTags.push(tag); } catch (e) { diff --git a/src/api/routes/files/tagAddPOST.js b/src/api/routes/files/tagAddPOST.js index 2bbfa07..0a0ab42 100644 --- a/src/api/routes/files/tagAddPOST.js +++ b/src/api/routes/files/tagAddPOST.js @@ -20,7 +20,7 @@ class tagAddPOST extends Route { if (!tag) return res.status(400).json({ message: 'Tag doesn\'t exist. ' }); try { - await db.table('fileTags').insert({ fileId, tagId: tag.id }); + await db.table('fileTags').insert({ fileId, tagId: tag.id }).wasMutated(); } catch (error) { return super.error(res, error); } diff --git a/src/api/routes/files/tagDelPOST.js b/src/api/routes/files/tagDelPOST.js index ac0bfe4..78e461b 100644 --- a/src/api/routes/files/tagDelPOST.js +++ b/src/api/routes/files/tagDelPOST.js @@ -22,7 +22,8 @@ class tagDelPost extends Route { try { await db.table('fileTags') .where({ fileId, tagId: tag.id }) - .delete(); + .delete() + .wasMutated(); } catch (error) { return super.error(res, error); } |