Fix: Tests lint and src folder #138

Merged
KevinMidboe merged 27 commits from fix/tests-lint-and-src-folder into master 2022-08-20 15:41:47 +00:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit ff410194ed - Show all commits

View File

@@ -4,8 +4,8 @@ const establishedDatabase = require("../../database/database");
const mustBeAdmin = (req, res, next) => { const mustBeAdmin = (req, res, next) => {
const database = establishedDatabase; const database = establishedDatabase;
if (req.loggedInUser === undefined) { if (!req.loggedInUser) {
res.status(401).send({ return res.status(401).send({
success: false, success: false,
message: "You must be logged in." message: "You must be logged in."
}); });

View File

@@ -1,6 +1,6 @@
// eslint-disable-next-line consistent-return // eslint-disable-next-line consistent-return
const mustBeAuthenticated = (req, res, next) => { const mustBeAuthenticated = (req, res, next) => {
if (req.loggedInUser === undefined) { if (!req.loggedInUser) {
return res.status(401).send({ return res.status(401).send({
success: false, success: false,
message: "You must be logged in." message: "You must be logged in."

View File

@@ -3,9 +3,9 @@ const establishedDatabase = require("../../database/database");
/* eslint-disable consistent-return */ /* eslint-disable consistent-return */
const mustHaveAccountLinkedToPlex = (req, res, next) => { const mustHaveAccountLinkedToPlex = (req, res, next) => {
const database = establishedDatabase; const database = establishedDatabase;
const { loggedInUser } = req;
if (loggedInUser === null) { // TODO use mustByAuthenticated middleware
if (!req.loggedInUser) {
return res.status(401).send({ return res.status(401).send({
success: false, success: false,
message: "You must have your account linked to a plex account." message: "You must have your account linked to a plex account."
@@ -15,7 +15,7 @@ const mustHaveAccountLinkedToPlex = (req, res, next) => {
database database
.get( .get(
`SELECT plex_userid FROM settings WHERE user_name IS ?`, `SELECT plex_userid FROM settings WHERE user_name IS ?`,
loggedInUser.username req.loggedInUser.username
) )
.then(row => { .then(row => {
const plexUserId = row.plex_userid; const plexUserId = row.plex_userid;