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

feat: Refactor to Use credentialRepository for credential create. #17336

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vijayraghav-io
Copy link
Contributor

@vijayraghav-io vijayraghav-io commented Oct 25, 2024

What does this PR do?

Refer PR: #16878

To Do :
Remove explicit callings of BookingReferenceRepository.reconnectWithNewCredential() everywhere, introduced from the PR #16878, if that Issue fix PR is merged before.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Copy link

vercel bot commented Oct 25, 2024

@vijayraghav-io is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added ✨ feature New feature or request 💻 refactor labels Oct 25, 2024
@graphite-app graphite-app bot requested a review from a team October 25, 2024 18:45
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Oct 25, 2024
@graphite-app graphite-app bot requested a review from a team October 25, 2024 18:45
Copy link

graphite-app bot commented Oct 25, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (10/25/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (10/25/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add community label" took an action on this PR • (10/25/24)

1 label was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (10/28/24)

1 label was added to this PR based on Keith Williams's automation.

@Praashh Praashh self-assigned this Oct 26, 2024
type: appMetadata.type,
},
select: credentialForCalendarServiceSelect,
const createdcredential = await CredentialRepository.create({
Copy link
Contributor

Choose a reason for hiding this comment

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

The Prisma.JsonNull handling for key is also a solid choice for cleaner code. Nicely done!

Copy link

@Praashh Praashh left a comment

Choose a reason for hiding this comment

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

I did notice, In the second test case you are using the newGoogleCalCredentialId, This might be involuntary as google_meet_video should ideally connect to the newGoogleMeetCredentialId instead of newGoogleCalCredentialId.

@vijayraghav-io
Copy link
Contributor Author

vijayraghav-io commented Oct 27, 2024

I did notice, In the second test case you are using the newGoogleCalCredentialId, This might be involuntary as google_meet_video should ideally connect to the newGoogleMeetCredentialId instead of newGoogleCalCredentialId.

Good notice!. This is intentional, google_video being a special case and that's why this test case was added.
Please refer this

credentialId: updateManager.referencesToCreate[googleCalIndex].credentialId,

here the credential of googleCal is mapped to google_meet_video as well, while creating the bookingReferences for new booking.
As per the generic app installation flow, credential record for google_video will be created, but the keys will be empty, google_calendar 's credential is only used for google video as well.

@Praashh
Copy link

Praashh commented Oct 27, 2024

I did notice, In the second test case you are using the newGoogleCalCredentialId, This might be involuntary as google_meet_video should ideally connect to the newGoogleMeetCredentialId instead of newGoogleCalCredentialId.

Good notice!. This is intentional, google_video being a special case and that's why this test case was added. Please refer this

credentialId: updateManager.referencesToCreate[googleCalIndex].credentialId,

here the credential of googleCal is mapped to google_meet_video as well, while creating the bookingReferences for new booking. As per the generic app installation flow, credential record for google_video will be created, but the keys will be empty, google_calendar 's credential is only used for google video as well.

ahh got it, I need a final check, I'll let you know..

Copy link

@Praashh Praashh left a comment

Choose a reason for hiding this comment

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

tested the changes locally, looks good to me.

Copy link
Contributor

E2E results are ready!

Copy link
Contributor

@keithwillcode keithwillcode left a comment

Choose a reason for hiding this comment

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

Just blocking this from merge until @joeauyeung can take a look

@keithwillcode keithwillcode added the high-risk Requires approval by Foundation team label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Created by Linear-GitHub Sync ✨ feature New feature or request high-risk Requires approval by Foundation team ready-for-e2e 💻 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor to use CredentialRepository for credential create
4 participants