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

chore: migrate EmailVerification to pg #9492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jordanh
Copy link
Contributor

@jordanh jordanh commented Mar 2, 2024

Description

Resolves #9491

Testing scenarios

  • Migrations

    • Migrate up 2, inspect EmailVerification on pg
    • Migrate down 2, verify pg table is destroyed and rethinkdb unchanged
  • Can verify email address with token

Final checklist

  • I checked the code review guidelines
  • I have added Metrics Representative as reviewer(s) if my PR invovles metrics/data/analytics related changes
  • I have performed a self-review of my code, the same way I'd do it for any other team member
  • I have tested all cases I listed in the testing scenarios and I haven't found any issues or regressions
  • Whenever I took a non-obvious choice I added a comment explaining why I did it this way
  • I added the label Skip Maintainer Review Indicating the PR only requires reviewer review and can be merged right after it's approved if the PR introduces only minor changes, does not contain any architectural changes or does not introduce any new patterns and I think one review is sufficient'
  • PR title is human readable and could be used in changelog

@jordanh jordanh requested a review from mattkrick March 2, 2024 06:34
@github-actions github-actions bot requested a review from tghanken March 2, 2024 06:34
@github-actions github-actions bot added the size/m label Mar 2, 2024
@jordanh
Copy link
Contributor Author

jordanh commented Mar 2, 2024

Sasha fell asleep early, and I felt itchy

@@ -55,9 +57,9 @@ const signUpVerified = async (email: string) => {
expect(verifyEmail).toMatchObject({
data: {
verifyEmail: {
authToken: expect.toBeString(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting TS failures here

@@ -153,7 +155,7 @@ test.skip('autoJoin on multiple teams does not create duplicate `OrganizationUse
const newEmail = `${faker.internet.userName()}@${domain}`.toLowerCase()
const {user: newUser} = await signUpVerified(newEmail)

expect(newUser.tms).toIncludeSameMembers(teamIds)
expect(newUser.tms).toEqual(expect.arrayContaining(teamIds))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and here...

@@ -12,16 +10,14 @@ interface Input {
}

export default class EmailVerification {
id: string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once again, id is now managed by PG

@jordanh jordanh force-pushed the chore/9491/migrate-emailverification branch from d67de35 to 98755f9 Compare March 3, 2024 17:55
.selectAll()
.where('email', '=', email)
.where('expiration', '>', new Date())
.executeTakeFirst()) || null
Copy link
Member

Choose a reason for hiding this comment

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

+1 no need to coerce to null since kysely will return undefined which works just as well in this case

.selectFrom('EmailVerification')
.selectAll()
.where('token', '=', verificationToken)
.executeTakeFirst()) as EmailVerification) || null
Copy link
Member

Choose a reason for hiding this comment

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

+1 no need to coerce to EmailVerification || null since kysely knows the return type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore: migrate EmailVerification to pg (1/1)
2 participants