Skip to content

Restore firstname lastname on address#11

Open
JustShah wants to merge 4 commits intomainfrom
restore-firstname-lastname-on-address
Open

Restore firstname lastname on address#11
JustShah wants to merge 4 commits intomainfrom
restore-firstname-lastname-on-address

Conversation

@JustShah
Copy link
Collaborator

@JustShah JustShah commented Feb 21, 2025

Description:

This PR introduces updates to the address model, admin components, backend, API, and associated logic to handle firstname and lastname as separate fields, replacing the previous name field providing backwards compatibility to existing implementations of name. The updates aim to improve data handling and increase clarity when working with user and address-related data.

For the purpose of not breaking name and provide a smooth transistion if first and last name are used name is compiled with the concatenated value allowing the fields to coexist.

Changes:

  • Admin: Updated admin components to use firstname and lastname fields separately in place of the name field.
  • Backend: Modified backend logic to separate name into firstname and lastname, adjusting user and address forms, search functionality, and related views.
  • API: Updated the API and its associated tests to manage firstname and lastname fields separately, replacing the name field.
  • Core: Unignored the firstname and lastname fields in the address model. Introduced a set_full_name method for backward compatibility, concatenating firstname and lastname. Updated tests, factories, and locales to align with the new model structure.

@fthobe
Copy link

fthobe commented Feb 21, 2025

User stories that are not captured by the current implementation:

  • name is removed from API breaking any current api based frontend relying on it (all)
  • name is removed from backend breaking all workflows currently relying on it

What should have been done instead:

  • name as well as first_name and last_name should be continuously available on admin and api allowing users the choice to use either one of them
  • where name is not compiled, first_name & last_name are used to populate
  • if first_name and last_name are transmitted during any update they overwrite name
  • if name is used, first_name and last_name do not overwrite it
  • you can't save an entry without either first_name or name
  • where addresses are created / edited first_name and last_name in admin they can be shown as only option, though having all three would be preferable

@JustShah JustShah force-pushed the restore-firstname-lastname-on-address branch from 81ad8b4 to a24c7c8 Compare February 24, 2025 13:44
- Unignored `firstname` and `lastname` field in the address model.
- Updated validations, attributes, and views to handle 'firstname' and 'lastname' separately.
- Modified tests, factories, and locales to align with the new structure.
- Introduced a 'set_full_name' method callback to concatenate 'firstname' and 'lastname' for backward compatibility.
Update the address handling logic in the APIs and tests to for 'firstname' and 'lastname' fields, instead of using a single 'name' field.
@JustShah JustShah force-pushed the restore-firstname-lastname-on-address branch 2 times, most recently from 9655ed5 to f10964e Compare February 24, 2025 14:54
- Update the backend logic to separate 'name', 'firstname' and 'lastname' for better data handling.
- Adjusted user and address forms, search functionality, and related views to use the new fields.
Update the address handling logic in the admin components and tests for 'firstname' and 'lastname' fields,
instead of using a single 'name' field.
@JustShah JustShah force-pushed the restore-firstname-lastname-on-address branch from f10964e to 53e1733 Compare February 24, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants