fix: updated plex_userid to camelcase

This commit is contained in:
2022-08-19 10:49:58 +02:00
parent 2aace85418
commit e8ad9367c9
3 changed files with 15 additions and 15 deletions

View File

@@ -22,10 +22,10 @@ class Tautulli {
throw error;
}
getPlaysByDayOfWeek(plex_userid, days, y_axis) {
getPlaysByDayOfWeek(plexUserId, days, y_axis) {
const url = this.buildUrlWithCmdAndUserid(
"get_plays_by_dayofweek",
plex_userid
plexUserId
);
url.searchParams.append("time_range", days);
url.searchParams.append("y_axis", y_axis);
@@ -35,8 +35,8 @@ class Tautulli {
.catch(error => this.logTautulliError(error));
}
getPlaysByDays(plex_userid, days, y_axis) {
const url = this.buildUrlWithCmdAndUserid("get_plays_by_date", plex_userid);
getPlaysByDays(plexUserId, days, y_axis) {
const url = this.buildUrlWithCmdAndUserid("get_plays_by_date", plexUserId);
url.searchParams.append("time_range", days);
url.searchParams.append("y_axis", y_axis);
@@ -45,10 +45,10 @@ class Tautulli {
.catch(error => this.logTautulliError(error));
}
watchTimeStats(plex_userid) {
watchTimeStats(plexUserId) {
const url = this.buildUrlWithCmdAndUserid(
"get_user_watch_time_stats",
plex_userid
plexUserId
);
url.searchParams.append("grouping", 0);
@@ -57,8 +57,8 @@ class Tautulli {
.catch(error => this.logTautulliError(error));
}
viewHistory(plex_userid) {
const url = this.buildUrlWithCmdAndUserid("get_history", plex_userid);
viewHistory(plexUserId) {
const url = this.buildUrlWithCmdAndUserid("get_history", plexUserId);
url.searchParams.append("start", 0);
url.searchParams.append("length", 50);

View File

@@ -22,7 +22,7 @@ function watchTimeStatsController(req, res) {
const user = req.loggedInUser;
return tautulli
.watchTimeStats(user.plex_userid)
.watchTimeStats(user.plexUserId)
.then(data => {
return res.send({
success: true,
@@ -38,7 +38,7 @@ function getPlaysByDayOfWeekController(req, res) {
const { days, y_axis } = req.query;
return tautulli
.getPlaysByDayOfWeek(user.plex_userid, days, y_axis)
.getPlaysByDayOfWeek(user.plexUserId, days, y_axis)
.then(data =>
res.send({
success: true,
@@ -69,7 +69,7 @@ function getPlaysByDaysController(req, res) {
}
return tautulli
.getPlaysByDays(user.plex_userid, days, y_axis)
.getPlaysByDays(user.plexUserId, days, y_axis)
.then(data =>
res.send({
success: true,
@@ -86,7 +86,7 @@ function userViewHistoryController(req, res) {
// and then return 501 Not implemented
return tautulli
.viewHistory(user.plex_userid)
.viewHistory(user.plexUserId)
.then(data => {
return res.send({
success: true,

View File

@@ -16,16 +16,16 @@ const mustHaveAccountLinkedToPlex = (req, res, next) => {
loggedInUser.username
)
.then(row => {
const { plex_userid } = row;
const plexUserId = row?.plex_userid;
if (plex_userid === null || plex_userid === undefined) {
if (plexUserId === null || plexUserId === undefined) {
return res.status(403).send({
success: false,
message:
"No plex account user id found for your user. Please authenticate your plex account at /user/authenticate."
});
}
req.loggedInUser.plex_userid = plex_userid;
req.loggedInUser.plexUserId = plexUserId;
return next();
});
};