-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added extension field with a max size of 254 #421
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
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.
Overall looks good. Just the one naming nitpick and a question.
@@ -90,6 +90,7 @@ class ContactInfoDAO(Base): | |||
hq_address_zip: Mapped[str] = mapped_column(String(5)) | |||
email: Mapped[str] | |||
phone_number: Mapped[str] | |||
extension: Mapped[str] = mapped_column(String(254), nullable=True) |
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.
Could you make this phone_ext
. I think that's what we agreed to and the last meeting, and I think what @shindigira is coding to on cfpb/sbl-frontend#961.
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.
Done
@@ -60,6 +60,7 @@ class ContactInfoDTO(BaseModel): | |||
hq_address_zip: str | |||
email: str | |||
phone_number: str | |||
extension: str | None = Field(None, max_length=254) |
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.
What happens when max_length
is exceeded? I can see from the test that it raises a 422
, which seems appropriate. Does Pydantic give a meaningful error too?
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.
You'll get a response json that looks like:
{'error_name': 'Request Validation Failure', 'error_detail': "[{'type': 'string_too_long', 'loc': ('body', 'phone_ext'), 'msg': 'String should have at most 254 characters', 'input': '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890', 'ctx': {'max_length': 254}}]"}
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.
Gotcha. OK, I think that is fine as far as this PR goes. I don't love these big Pydantic barf error messages, but that's an issue for another day. 😄
## Note Be sure the pull the latest from [_sbl-filing_](cfpb/sbl-filing-api#421) via `yarn update` closes #945 ## Changes - feat(Point of Contact): Added Phone Extension field to Point of Contact Field - chore(Point of Contact): Phone Extension breakpoint of 600px - feat(Sign and Submit): Added Phone Extension field to Verification field - chore(Sign and Submit): Matched order of fields to be the same as Point of Contact - feat(e2e): Added Phone Extension field to e2e test - style(DisplayField): added `work-break: break-all;` - content(Sign and Submit): added 'Extension' ## How to test this PR ### First Test 1. Upload a filing and navigate all the way to _Point of Contact_ 2. Verify the Phone Extension in both mobile and desktop (901 px and _above_) 3. Open the Network tab, submit and verify the request and response jsons contain the phone extension (i.e. `phone_ext`) ### Second Test 1. Navigate all the way to _Sign and Submit_ 2. Verify the `DisplayField` contains the submitted phone extension ### Third Test 1. Run `yarn run test:e2e` 2. Run the _sign-and-submit_ test to ensure it passes ## Screenshots | PoC (Desktop) | PoC (Mobile) | Sign and Submit | | -------- | ------- | ------- | |<img width="533" alt="Screenshot 2024-09-30 at 9 07 06 AM" src="https://github.com/user-attachments/assets/2210a4d8-e088-4cad-9d78-392aabc0de41">|<img width="516" alt="Screenshot 2024-09-30 at 9 07 20 AM" src="https://github.com/user-attachments/assets/cc203268-85bf-4826-8adc-d4740d1a91ea">|<img width="632" alt="Screenshot 2024-09-30 at 2 18 43 PM" src="https://github.com/user-attachments/assets/d18a1416-1cbc-494f-a561-d3cd44df22ba">|
Be sure the pull the latest from [_sbl-filing_](cfpb/sbl-filing-api#421) via `yarn update` closes #945 - feat(Point of Contact): Added Phone Extension field to Point of Contact Field - chore(Point of Contact): Phone Extension breakpoint of 600px - feat(Sign and Submit): Added Phone Extension field to Verification field - chore(Sign and Submit): Matched order of fields to be the same as Point of Contact - feat(e2e): Added Phone Extension field to e2e test - style(DisplayField): added `work-break: break-all;` - content(Sign and Submit): added 'Extension' 1. Upload a filing and navigate all the way to _Point of Contact_ 2. Verify the Phone Extension in both mobile and desktop (901 px and _above_) 3. Open the Network tab, submit and verify the request and response jsons contain the phone extension (i.e. `phone_ext`) 1. Navigate all the way to _Sign and Submit_ 2. Verify the `DisplayField` contains the submitted phone extension 1. Run `yarn run test:e2e` 2. Run the _sign-and-submit_ test to ensure it passes | PoC (Desktop) | PoC (Mobile) | Sign and Submit | | -------- | ------- | ------- | |<img width="533" alt="Screenshot 2024-09-30 at 9 07 06 AM" src="https://github.com/user-attachments/assets/2210a4d8-e088-4cad-9d78-392aabc0de41">|<img width="516" alt="Screenshot 2024-09-30 at 9 07 20 AM" src="https://github.com/user-attachments/assets/cc203268-85bf-4826-8adc-d4740d1a91ea">|<img width="632" alt="Screenshot 2024-09-30 at 2 18 43 PM" src="https://github.com/user-attachments/assets/d18a1416-1cbc-494f-a561-d3cd44df22ba">|
Closes #420