Skip to content

Commit

Permalink
Implement plex server editing. Fixes #123
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbenincasa committed Feb 28, 2024
1 parent dbf1463 commit a1187eb
Show file tree
Hide file tree
Showing 2 changed files with 291 additions and 55 deletions.
22 changes: 8 additions & 14 deletions server/dao/plexServerDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,19 @@ export class PlexServerDB {
throw Error("Server doesn't exist.");
}

const sendGuideUpdates = server.sendGuideUpdates ?? false;
const sendChannelUpdates = server.sendChannelUpdates ?? false;

const newServer = em.create(PlexServerSettingsEntity, {
...server,
uuid: id,
name: s.name,
uri: server.uri,
em.assign(s, {
name: server.name,
accessToken: server.accessToken,
sendGuideUpdates,
sendChannelUpdates,
index: s.index,
sendGuideUpdates: server.sendGuideUpdates ?? false,
sendChannelUpdates: server.sendChannelUpdates ?? false,
updatedAt: new Date(),
});

this.normalizeServer(newServer);
this.normalizeServer(s);

const report = await this.fixupProgramReferences(id, newServer);
const report = await this.fixupProgramReferences(id, s);

await repo.upsert(newServer);
await repo.upsert(s);
await em.flush();

return report;
Expand Down
Loading

0 comments on commit a1187eb

Please sign in to comment.