Fix: Tests lint and src folder #138
@@ -4,8 +4,8 @@ const establishedDatabase = require("../../database/database");
|
||||
const mustBeAdmin = (req, res, next) => {
|
||||
const database = establishedDatabase;
|
||||
|
||||
if (req.loggedInUser === undefined) {
|
||||
res.status(401).send({
|
||||
if (!req.loggedInUser) {
|
||||
return res.status(401).send({
|
||||
success: false,
|
||||
message: "You must be logged in."
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line consistent-return
|
||||
const mustBeAuthenticated = (req, res, next) => {
|
||||
if (req.loggedInUser === undefined) {
|
||||
if (!req.loggedInUser) {
|
||||
return res.status(401).send({
|
||||
success: false,
|
||||
message: "You must be logged in."
|
||||
|
||||
@@ -3,9 +3,9 @@ const establishedDatabase = require("../../database/database");
|
||||
/* eslint-disable consistent-return */
|
||||
const mustHaveAccountLinkedToPlex = (req, res, next) => {
|
||||
const database = establishedDatabase;
|
||||
const { loggedInUser } = req;
|
||||
|
||||
if (loggedInUser === null) {
|
||||
// TODO use mustByAuthenticated middleware
|
||||
if (!req.loggedInUser) {
|
||||
return res.status(401).send({
|
||||
success: false,
|
||||
message: "You must have your account linked to a plex account."
|
||||
@@ -15,7 +15,7 @@ const mustHaveAccountLinkedToPlex = (req, res, next) => {
|
||||
database
|
||||
.get(
|
||||
`SELECT plex_userid FROM settings WHERE user_name IS ?`,
|
||||
loggedInUser.username
|
||||
req.loggedInUser.username
|
||||
)
|
||||
.then(row => {
|
||||
const plexUserId = row.plex_userid;
|
||||
|
||||
Reference in New Issue
Block a user