UserRepository handles updating db settings better.
Moved the plex_userid to settings to expanded with functions for updating and fetching settings, each with its own helper function towards the database. Since we had a linkPlexUserId function and we dont want plex_userid to be updated from the updatesettings function we moved unlinking to a separate endpoint and class function. Also a new controller and endpoints for getting and updating settings.
This commit is contained in:
@@ -7,10 +7,10 @@ const mustHaveAccountLinkedToPlex = (req, res, next) => {
|
||||
if (loggedInUser === undefined) {
|
||||
return res.status(401).send({
|
||||
success: false,
|
||||
message: 'You must be logged in.',
|
||||
message: 'You must have your account linked to a plex account.',
|
||||
});
|
||||
} else {
|
||||
database.get(`SELECT plex_userid FROM user WHERE user_name IS ?`, loggedInUser.username)
|
||||
database.get(`SELECT plex_userid FROM settings WHERE user_name IS ?`, loggedInUser.username)
|
||||
.then(row => {
|
||||
const plex_userid = row.plex_userid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user