Reverting changes
This commit is contained in:
6
src/app.d.ts
vendored
6
src/app.d.ts
vendored
@@ -40,7 +40,7 @@ declare global {
|
|||||||
|
|
||||||
interface Connection {
|
interface Connection {
|
||||||
id: string
|
id: string
|
||||||
user: User
|
userId: string
|
||||||
service: Service
|
service: Service
|
||||||
tokens: Tokens
|
tokens: Tokens
|
||||||
}
|
}
|
||||||
@@ -184,8 +184,8 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface YTTokens implements Tokens {
|
interface YTTokens implements Tokens {
|
||||||
accessToken: string,
|
accessToken: string
|
||||||
refreshToken: string,
|
refreshToken: string
|
||||||
expiry: number
|
expiry: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,17 +53,16 @@ export class Users {
|
|||||||
export class Connections {
|
export class Connections {
|
||||||
static getConnection = (id: string): Connection => {
|
static getConnection = (id: string): Connection => {
|
||||||
const { userId, service, tokens } = db.prepare('SELECT * FROM Connections WHERE id = ?').get(id) as ConnectionsTableSchema
|
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
|
return connection
|
||||||
}
|
}
|
||||||
|
|
||||||
static getUserConnections = (userId: string): Connection[] => {
|
static getUserConnections = (userId: string): Connection[] => {
|
||||||
const connectionRows = db.prepare('SELECT * FROM Connections WHERE userId = ?').all(userId) as ConnectionsTableSchema[]
|
const connectionRows = db.prepare('SELECT * FROM Connections WHERE userId = ?').all(userId) as ConnectionsTableSchema[]
|
||||||
const connections: Connection[] = []
|
const connections: Connection[] = []
|
||||||
const user = Users.getUser(userId)!
|
|
||||||
connectionRows.forEach((row) => {
|
connectionRows.forEach((row) => {
|
||||||
const { id, service, tokens } = 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
|
return connections
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user