-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate connected account model #2944
Conversation
bosiraphael
commented
Dec 11, 2023
- Migrated data model
- Added email to connected account
- Prevent user from connecting with the same account multiple times
await workspaceDataSource?.query( | ||
`INSERT INTO ${dataSourceMetadata.schema}."connectedAccount" ("type", "accessToken", "refreshToken") VALUES ('${type}', '${accessToken}', '${refreshToken}')`, | ||
const connectedAccount = await workspaceDataSource?.query( | ||
`SELECT * FROM ${dataSourceMetadata.schema}."connectedAccount" WHERE "email" = '${email}' AND "type" = '${type}'`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably prone to SQL injection as those come from your input. Use bind parameters instead.
query('SELECT * FROM connectedAccount WHERE email = $1', [email])
should work
…twenty into migrate-connectedAccount-model
@@ -90,6 +90,7 @@ export class WorkspaceSyncMetadataService { | |||
const objectInDB = objectsInDBByName[standardObjectName]; | |||
|
|||
if (!objectInDB) { | |||
console.log(standardObject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log