-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
Refs: HP-2344
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
aeea8e4
to
74298f3
Compare
Quality Gate passedIssues Measures |
HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr488.api.dev.hel.ninja 🚀🚀🚀 |
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.
LGTM 👍 ✂️
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) | ||
) |
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.
Nice.
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.