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

Names lookup in Register that Notifications can use in keyword replacement #593

Closed
7 tasks done
SandGrainOne opened this issue Aug 16, 2024 · 4 comments
Closed
7 tasks done
Assignees
Labels
kind/user-story Used for issues that describes functionality for our users.

Comments

@SandGrainOne
Copy link
Member

SandGrainOne commented Aug 16, 2024

Description

Notifications have a needs for the first, middle and last name of a person as separate properties. The values will be used in search and replace operations when notification texts contains keyword for those values. Register currently doesn't have a suitable endpoint that provide this, so we need to make changes to Register.

This issue will make changes to the register/api/v1/parties/nameslookup endpoint in Register with a new parameter and optionally include the name of a person as separate properties for first, middle and last name.

Additional Information

There was an analysis of existing endpoints in Register: #589. This concluded that we needed changes in Register and potentially in Altinn 2 (bridge). After a talk with the team responsible for Register we've found a solution isolated to Register.

Tasks

  • Expand the Altinn.Platform.Register.Models.PartyName model with properties for FirstName, MiddleName and LastName. Decorate the properties with [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
  • Rewrite the Altinn.Register.Clients.PartiesClient.GetOrAddPartyNameToCacheAsync() method to support a more complex entity instead of only a single string. It's a private method so we could consider using a record struct.
  • Add a parameter to the Altinn.Register.Controllers.PartiesController.PostPartyNamesLookup() method called splitpersonname. The value should be used to optionally populate first, middle and last name during mapping to the PartyName model. (In a future version of Register the default behavior of the logic is to not retrieve the values from the database unless specifically asked for. This is future proofing.)
  • Update the call chain between private methods in the PartiesClient class to support the struct. It should be unnecessary to make any changes to LookupPartyBySSNOrOrgNo().

Acceptance Criterias

  • The Register API register/api/v1/parties/nameslookup endpoint returns the person name split across separate properties in addition to the original name property.
  • The new properties are null for organizations and excluded during serialization.
  • MiddleName is null and excluded during serialization unless the person actually have a middle name.

Post-Implementation Changes

The register/api/v1/parties/nameslookup endpoint has been updated to accept a new query parameter: partyComponentOption. Below are the use cases and expected outcomes for this parameter:

  • ?partyComponentOption=person-name: Name components will be populated and returned.
  • ?partyComponentOption=none: A "Bad Request" error will be returned.
  • ?partyComponentOption=anything-else: A "Bad Request" error will be returned.
@SandGrainOne SandGrainOne added kind/user-story Used for issues that describes functionality for our users. status/draft Status: When you create an issue before you have enough info to properly describe the issue. labels Aug 16, 2024
@olebhansen olebhansen added the status/pending-feedback Awaiting clarification/input from stakeholders etc. label Aug 20, 2024
@olebhansen
Copy link

Checking with Register to get any inputs and/or a go-ahead to do the change and sent a PR.

@olebhansen olebhansen removed the status/pending-feedback Awaiting clarification/input from stakeholders etc. label Aug 27, 2024
@olebhansen
Copy link

OK to submit PR. Check/validate approach with @Alxandr before starting.

@olebhansen
Copy link

Input from refinement: v1 can be 1-by-1 lookups

@SandGrainOne SandGrainOne removed the status/draft Status: When you create an issue before you have enough info to properly describe the issue. label Sep 10, 2024
@SandGrainOne SandGrainOne removed their assignment Sep 10, 2024
@Ahmed-Ghanam Ahmed-Ghanam self-assigned this Sep 13, 2024
@Ahmed-Ghanam Ahmed-Ghanam removed their assignment Sep 25, 2024
@SandGrainOne SandGrainOne self-assigned this Sep 25, 2024
@SandGrainOne
Copy link
Member Author

Manual testing: Looks fine. Working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/user-story Used for issues that describes functionality for our users.
Projects
None yet
Development

No branches or pull requests

3 participants