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

HP-2344 | Shorten profile name fields to 150 characters #488

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

charn
Copy link
Contributor

@charn charn commented Apr 17, 2024

First and last name need to be limited to 150 characters on the Profile model. Updates to name fields are also sent to keycloak, which will put the name information into the API tokens that it produces.

User model has 150 character name fields. Upon receiving an API token this backend will try to update the user object with the information in the token. If a name field is over 150 characters an error will be produced and the user will be unable to use the API. Users with this error will also be unable to resolve the issue by themselves.

@charn charn requested a review from a team April 17, 2024 10:16
@terovirtanen
Copy link
Contributor

HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr488.api.dev.hel.ninja 🚀🚀🚀

First and last name need to be limited to 150 characters on the Profile model.
Updates to name information are also sent to keycloak, which will put the name
information into the API tokens that it produces.

User model has 150 character name fields. Upon receiving an API token
this backend will try to update the user object with the information in
the token. If the name is over 150 characters an error will be produced
and the user will be unable to use the API. Users with this error will
also be unable to resolve the issue by themselves.

Refs: HP-2344
@charn charn force-pushed the HP-2344-profile-name-field-length branch from aeea8e4 to 74298f3 Compare April 17, 2024 12:00
Copy link

@terovirtanen
Copy link
Contributor

HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr488.api.dev.hel.ninja 🚀🚀🚀

Copy link
Contributor

@tuomas777 tuomas777 left a comment

Choose a reason for hiding this comment

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

LGTM 👍 ✂️

Comment on lines +9 to +13
def truncate_name_fields(apps, schema_editor):
Profile = apps.get_model("profiles", "Profile")
Profile.objects.update(
first_name=Substr("first_name", 1, 150), last_name=Substr("last_name", 1, 150)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@charn charn merged commit 0ee92ae into main Apr 18, 2024
23 checks passed
@charn charn deleted the HP-2344-profile-name-field-length branch April 18, 2024 06:28
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.

3 participants