aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/albums/link/linkPOST.js
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-08 04:00:12 +0300
committerZephyrrus <[email protected]>2020-07-08 04:00:12 +0300
commitad852de51a0d2dd5d29c08838d5a430c58849e74 (patch)
treea4ab9a720f66271c9eba10916061a9b06c43656e /src/api/routes/albums/link/linkPOST.js
parentrefactor: refactor grid to use vuex for every action (diff)
downloadhost.fuwn.me-ad852de51a0d2dd5d29c08838d5a430c58849e74.tar.xz
host.fuwn.me-ad852de51a0d2dd5d29c08838d5a430c58849e74.zip
chore: linter the entire project using the new rules
Diffstat (limited to 'src/api/routes/albums/link/linkPOST.js')
-rw-r--r--src/api/routes/albums/link/linkPOST.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/api/routes/albums/link/linkPOST.js b/src/api/routes/albums/link/linkPOST.js
index 7ecc5cb..d58598a 100644
--- a/src/api/routes/albums/link/linkPOST.js
+++ b/src/api/routes/albums/link/linkPOST.js
@@ -28,15 +28,13 @@ class linkPOST extends Route {
.where('albumId', albumId)
.count({ count: 'id' })
.first();
- if (count >= parseInt(process.env.MAX_LINKS_PER_ALBUM, 10))
- return res.status(400).json({ message: 'Maximum links per album reached' });
+ if (count >= parseInt(process.env.MAX_LINKS_PER_ALBUM, 10)) return res.status(400).json({ message: 'Maximum links per album reached' });
/*
Try to allocate a new identifier on the db
*/
const identifier = await Util.getUniqueAlbumIdentifier();
- if (!identifier)
- return res.status(500).json({ message: 'There was a problem allocating a link for your album' });
+ if (!identifier) return res.status(500).json({ message: 'There was a problem allocating a link for your album' });
try {
const insertObj = {
@@ -46,13 +44,13 @@ class linkPOST extends Route {
enabled: true,
enableDownload: true,
expiresAt: null,
- views: 0
+ views: 0,
};
await db.table('links').insert(insertObj);
return res.json({
message: 'The link was created successfully',
- data: insertObj
+ data: insertObj,
});
} catch (error) {
return super.error(res, error);