feat: resolve preferredname at datasource layer to eliminate firstname fallback checks#1415
Open
William-Edwards-STFC wants to merge 11 commits intodevelopfrom
Open
feat: resolve preferredname at datasource layer to eliminate firstname fallback checks#1415William-Edwards-STFC wants to merge 11 commits intodevelopfrom
William-Edwards-STFC wants to merge 11 commits intodevelopfrom
Conversation
Contributor
|
@William-Edwards-STFC I am a bit non inclined with this. The Datasource layer needs to be as much as less opinionated towards the business layer. It should always bring out the truth in the raw form from the database, without altering the data. It is the business layer that should decide. If you require a need for a preferred name to always have a non nullable value, then we need to discuss and fix it from ground zero(ie., change the column type from nullable to non-nullable and proceed with other layers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, preferredname was nullable throughout the codebase, requiring a preferredname ? preferredname : firstname check everywhere a user's name was displayed. This change moves the fallback logic to the datasource layer so that preferredname is always populated, removing the need for these checks across the frontend and backend.
Motivation and Context
The repeated fallback checks were scattered across utility functions, components, and backend code we may as well just do it once. firstname is kept separate on the model so it remains available for use in official documents.
How Has This Been Tested
Fixes
UserOfficeProject/issue-tracker#1499
Changes
Tests included/Docs Updated?
Issue number is 1499 got a bit mixed up whilst doing commits