diff --git a/src/app.d.ts b/src/app.d.ts index d2c596e..8ea8227 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -40,7 +40,7 @@ declare global { interface Connection { id: string - user: User + userId: string service: Service tokens: Tokens } @@ -184,8 +184,8 @@ declare global { } interface YTTokens implements Tokens { - accessToken: string, - refreshToken: string, + accessToken: string + refreshToken: string expiry: number } diff --git a/src/lib/server/users.ts b/src/lib/server/users.ts index a78503f..d8c0625 100644 --- a/src/lib/server/users.ts +++ b/src/lib/server/users.ts @@ -53,17 +53,16 @@ export class Users { export class Connections { static getConnection = (id: string): Connection => { const { userId, service, tokens } = db.prepare('SELECT * FROM Connections WHERE id = ?').get(id) as ConnectionsTableSchema - const connection: Connection = { id, user: Users.getUser(userId)!, service: JSON.parse(service), tokens: JSON.parse(tokens) } + const connection: Connection = { id, userId, service: JSON.parse(service), tokens: JSON.parse(tokens) } return connection } static getUserConnections = (userId: string): Connection[] => { const connectionRows = db.prepare('SELECT * FROM Connections WHERE userId = ?').all(userId) as ConnectionsTableSchema[] const connections: Connection[] = [] - const user = Users.getUser(userId)! connectionRows.forEach((row) => { const { id, service, tokens } = row - connections.push({ id, user, service: JSON.parse(service), tokens: JSON.parse(tokens) }) + connections.push({ id, userId, service: JSON.parse(service), tokens: JSON.parse(tokens) }) }) return connections }