Skip to content
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

Merged
merged 9 commits into from
Dec 12, 2023
Merged

Conversation

bosiraphael
Copy link
Contributor

  • 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}'`,
Copy link
Member

@Weiko Weiko Dec 11, 2023

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

@@ -90,6 +90,7 @@ export class WorkspaceSyncMetadataService {
const objectInDB = objectsInDBByName[standardObjectName];

if (!objectInDB) {
console.log(standardObject);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log

@bosiraphael bosiraphael merged commit 95002f5 into main Dec 12, 2023
6 of 11 checks passed
@bosiraphael bosiraphael deleted the migrate-connectedAccount-model branch December 12, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants