fix: updated plex_userid to camelcase
This commit is contained in:
@@ -22,10 +22,10 @@ class Tautulli {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlaysByDayOfWeek(plex_userid, days, y_axis) {
|
getPlaysByDayOfWeek(plexUserId, days, y_axis) {
|
||||||
const url = this.buildUrlWithCmdAndUserid(
|
const url = this.buildUrlWithCmdAndUserid(
|
||||||
"get_plays_by_dayofweek",
|
"get_plays_by_dayofweek",
|
||||||
plex_userid
|
plexUserId
|
||||||
);
|
);
|
||||||
url.searchParams.append("time_range", days);
|
url.searchParams.append("time_range", days);
|
||||||
url.searchParams.append("y_axis", y_axis);
|
url.searchParams.append("y_axis", y_axis);
|
||||||
@@ -35,8 +35,8 @@ class Tautulli {
|
|||||||
.catch(error => this.logTautulliError(error));
|
.catch(error => this.logTautulliError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlaysByDays(plex_userid, days, y_axis) {
|
getPlaysByDays(plexUserId, days, y_axis) {
|
||||||
const url = this.buildUrlWithCmdAndUserid("get_plays_by_date", plex_userid);
|
const url = this.buildUrlWithCmdAndUserid("get_plays_by_date", plexUserId);
|
||||||
url.searchParams.append("time_range", days);
|
url.searchParams.append("time_range", days);
|
||||||
url.searchParams.append("y_axis", y_axis);
|
url.searchParams.append("y_axis", y_axis);
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ class Tautulli {
|
|||||||
.catch(error => this.logTautulliError(error));
|
.catch(error => this.logTautulliError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
watchTimeStats(plex_userid) {
|
watchTimeStats(plexUserId) {
|
||||||
const url = this.buildUrlWithCmdAndUserid(
|
const url = this.buildUrlWithCmdAndUserid(
|
||||||
"get_user_watch_time_stats",
|
"get_user_watch_time_stats",
|
||||||
plex_userid
|
plexUserId
|
||||||
);
|
);
|
||||||
url.searchParams.append("grouping", 0);
|
url.searchParams.append("grouping", 0);
|
||||||
|
|
||||||
@@ -57,8 +57,8 @@ class Tautulli {
|
|||||||
.catch(error => this.logTautulliError(error));
|
.catch(error => this.logTautulliError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewHistory(plex_userid) {
|
viewHistory(plexUserId) {
|
||||||
const url = this.buildUrlWithCmdAndUserid("get_history", plex_userid);
|
const url = this.buildUrlWithCmdAndUserid("get_history", plexUserId);
|
||||||
|
|
||||||
url.searchParams.append("start", 0);
|
url.searchParams.append("start", 0);
|
||||||
url.searchParams.append("length", 50);
|
url.searchParams.append("length", 50);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function watchTimeStatsController(req, res) {
|
|||||||
const user = req.loggedInUser;
|
const user = req.loggedInUser;
|
||||||
|
|
||||||
return tautulli
|
return tautulli
|
||||||
.watchTimeStats(user.plex_userid)
|
.watchTimeStats(user.plexUserId)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return res.send({
|
return res.send({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -38,7 +38,7 @@ function getPlaysByDayOfWeekController(req, res) {
|
|||||||
const { days, y_axis } = req.query;
|
const { days, y_axis } = req.query;
|
||||||
|
|
||||||
return tautulli
|
return tautulli
|
||||||
.getPlaysByDayOfWeek(user.plex_userid, days, y_axis)
|
.getPlaysByDayOfWeek(user.plexUserId, days, y_axis)
|
||||||
.then(data =>
|
.then(data =>
|
||||||
res.send({
|
res.send({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -69,7 +69,7 @@ function getPlaysByDaysController(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return tautulli
|
return tautulli
|
||||||
.getPlaysByDays(user.plex_userid, days, y_axis)
|
.getPlaysByDays(user.plexUserId, days, y_axis)
|
||||||
.then(data =>
|
.then(data =>
|
||||||
res.send({
|
res.send({
|
||||||
success: true,
|
success: true,
|
||||||
@@ -86,7 +86,7 @@ function userViewHistoryController(req, res) {
|
|||||||
// and then return 501 Not implemented
|
// and then return 501 Not implemented
|
||||||
|
|
||||||
return tautulli
|
return tautulli
|
||||||
.viewHistory(user.plex_userid)
|
.viewHistory(user.plexUserId)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return res.send({
|
return res.send({
|
||||||
success: true,
|
success: true,
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ const mustHaveAccountLinkedToPlex = (req, res, next) => {
|
|||||||
loggedInUser.username
|
loggedInUser.username
|
||||||
)
|
)
|
||||||
.then(row => {
|
.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({
|
return res.status(403).send({
|
||||||
success: false,
|
success: false,
|
||||||
message:
|
message:
|
||||||
"No plex account user id found for your user. Please authenticate your plex account at /user/authenticate."
|
"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();
|
return next();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user