aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/albums
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
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')
-rw-r--r--src/api/routes/albums/albumDELETE.js1
-rw-r--r--src/api/routes/albums/albumPOST.js4
-rw-r--r--src/api/routes/albums/albumZipGET.js10
-rw-r--r--src/api/routes/albums/link/linkDELETE.js3
-rw-r--r--src/api/routes/albums/link/linkEditPOST.js3
-rw-r--r--src/api/routes/albums/link/linkPOST.js10
-rw-r--r--src/api/routes/albums/link/linksGET.js2
7 files changed, 14 insertions, 19 deletions
diff --git a/src/api/routes/albums/albumDELETE.js b/src/api/routes/albums/albumDELETE.js
index 4e6640e..f9c22e6 100644
--- a/src/api/routes/albums/albumDELETE.js
+++ b/src/api/routes/albums/albumDELETE.js
@@ -1,5 +1,4 @@
const Route = require('../../structures/Route');
-const Util = require('../../utils/Util');
class albumDELETE extends Route {
constructor() {
diff --git a/src/api/routes/albums/albumPOST.js b/src/api/routes/albums/albumPOST.js
index 841da3d..94ee8a7 100644
--- a/src/api/routes/albums/albumPOST.js
+++ b/src/api/routes/albums/albumPOST.js
@@ -1,5 +1,5 @@
-const Route = require('../../structures/Route');
const moment = require('moment');
+const Route = require('../../structures/Route');
class albumPOST extends Route {
constructor() {
@@ -25,7 +25,7 @@ class albumPOST extends Route {
name,
userId: user.id,
createdAt: now,
- editedAt: now
+ editedAt: now,
};
const dbRes = await db.table('albums').insert(insertObj);
diff --git a/src/api/routes/albums/albumZipGET.js b/src/api/routes/albums/albumZipGET.js
index a6ef6fd..bd74ef3 100644
--- a/src/api/routes/albums/albumZipGET.js
+++ b/src/api/routes/albums/albumZipGET.js
@@ -1,8 +1,8 @@
+const path = require('path');
+const jetpack = require('fs-jetpack');
const Route = require('../../structures/Route');
const Util = require('../../utils/Util');
const log = require('../../utils/Log');
-const path = require('path');
-const jetpack = require('fs-jetpack');
class albumGET extends Route {
constructor() {
@@ -21,7 +21,7 @@ class albumGET extends Route {
.where({
identifier,
enabled: true,
- enableDownload: true
+ enableDownload: true,
})
.first();
if (!link) return res.status(400).json({ message: 'The supplied identifier could not be found' });
@@ -64,11 +64,11 @@ class albumGET extends Route {
/*
Get the actual files
*/
- const fileIds = fileList.map(el => el.fileId);
+ const fileIds = fileList.map((el) => el.fileId);
const files = await db.table('files')
.whereIn('id', fileIds)
.select('name');
- const filesToZip = files.map(el => el.name);
+ const filesToZip = files.map((el) => el.name);
try {
Util.createZip(filesToZip, album);
diff --git a/src/api/routes/albums/link/linkDELETE.js b/src/api/routes/albums/link/linkDELETE.js
index b02d0b4..0381b50 100644
--- a/src/api/routes/albums/link/linkDELETE.js
+++ b/src/api/routes/albums/link/linkDELETE.js
@@ -1,5 +1,4 @@
const Route = require('../../../structures/Route');
-const { dump } = require('dumper.js');
class linkDELETE extends Route {
constructor() {
@@ -28,7 +27,7 @@ class linkDELETE extends Route {
}
return res.json({
- message: 'Successfully deleted link'
+ message: 'Successfully deleted link',
});
}
}
diff --git a/src/api/routes/albums/link/linkEditPOST.js b/src/api/routes/albums/link/linkEditPOST.js
index 0c7233b..4e0e0e1 100644
--- a/src/api/routes/albums/link/linkEditPOST.js
+++ b/src/api/routes/albums/link/linkEditPOST.js
@@ -1,5 +1,4 @@
const Route = require('../../../structures/Route');
-const log = require('../../../utils/Log');
class linkEditPOST extends Route {
constructor() {
@@ -23,7 +22,7 @@ class linkEditPOST extends Route {
try {
const updateObj = {
enableDownload: enableDownload || false,
- expiresAt // This one should be null if not supplied
+ expiresAt, // This one should be null if not supplied
};
await db
.table('links')
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);
diff --git a/src/api/routes/albums/link/linksGET.js b/src/api/routes/albums/link/linksGET.js
index edab49a..4487c26 100644
--- a/src/api/routes/albums/link/linksGET.js
+++ b/src/api/routes/albums/link/linksGET.js
@@ -14,7 +14,7 @@ class linkPOST extends Route {
return res.json({
message: 'Successfully retrieved links',
- links
+ links,
});
}
}