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(phone): Add creat methods for recovery phone lib #17979

Merged
merged 1 commit into from
Nov 12, 2024
Merged

Conversation

vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Nov 5, 2024

Because

  • We want to be able to create recovery phone entries for a user

This pull request

  • Adds methods to create a recovery phone
  • Adds database migration to create the recovery phone table

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-10341
Closes: https://mozilla-hub.atlassian.net/browse/FXA-10330

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

@vbudhram vbudhram self-assigned this Nov 8, 2024
@vbudhram vbudhram changed the title feat(phone): Add create, get methods for recovery phone lib feat(phone): Add creat methods for recovery phone lib Nov 8, 2024
@vbudhram vbudhram marked this pull request as ready for review November 8, 2024 17:30
@vbudhram vbudhram requested a review from a team as a code owner November 8, 2024 17:30
@vbudhram vbudhram force-pushed the fxa-10341 branch 2 times, most recently from 3485ddb to 287b482 Compare November 8, 2024 19:04

import { BaseError } from '@fxa/shared/error';

export class RecoveryPhoneError extends BaseError {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

});

afterEach(async () => {
await db.destroy();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to create and destroy the db after each test, or can we just do this once for the test suite.


const uidBuffer = Buffer.from(uid, 'hex');

// TODO: Perform phone number validation here via https://www.twilio.com/docs/lookup/v2-api#making-a-request
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a follow up for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

phoneNumber: string;
createdAt: number;
lastConfirmed: number;
lookupData: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is lookup data?

Copy link
Contributor Author

@vbudhram vbudhram Nov 12, 2024

Choose a reason for hiding this comment

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

Looks like it stores information if the phone number is fradulent or active and can recieve message.

lookupData JSON,
PRIMARY KEY (uid),
INDEX idx_phoneNumber (phoneNumber),
FOREIGN KEY (uid) REFERENCES accounts(uid) ON DELETE CASCADE
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

Copy link
Contributor

@dschom dschom left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@vbudhram vbudhram merged commit 4fef7bb into main Nov 12, 2024
25 checks passed
@vbudhram vbudhram deleted the fxa-10341 branch November 12, 2024 16:22
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.

2 participants