Request Model (#79)

* feat(api): request model

Also adds request binding to search/discover results

* fix(api): rename Request to MediaRequest and update nextjs tsconfig

* refactor(api): move related request fetching code into MediaRequest entity
This commit is contained in:
sct
2020-09-13 00:01:38 +09:00
committed by GitHub
parent 342d1a3c75
commit 1910876706
9 changed files with 184 additions and 15 deletions

View File

@@ -37,7 +37,7 @@ authRoutes.post('/login', async (req, res) => {
// Next let's see if the user already exists
let user = await userRepository.findOne({
where: { email: account.email },
where: { plexId: account.id },
});
if (user) {
@@ -49,6 +49,8 @@ authRoutes.post('/login', async (req, res) => {
// Update the users avatar with their plex thumbnail (incase it changed)
user.avatar = account.thumb;
user.email = account.email;
user.username = account.username;
} else {
// Here we check if it's the first user. If it is, we create the user with no check
// and give them admin permissions
@@ -57,6 +59,8 @@ authRoutes.post('/login', async (req, res) => {
if (totalUsers === 0) {
user = new User({
email: account.email,
username: account.username,
plexId: account.id,
plexToken: account.authToken,
permissions: Permission.ADMIN,
avatar: account.thumb,