Reverting changes

This commit is contained in:
Eclypsed
2024-02-12 18:04:30 -05:00
parent 8544f66397
commit c365bcc540
2 changed files with 5 additions and 6 deletions

6
src/app.d.ts vendored
View File

@@ -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
}

View File

@@ -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
}