Tech Refinement - Search by loyalty ID

This document is based on this ADR

Acceptance Criteria

Be able to search a customer using the loyalty ID and add a new line on search labels.

This should follow the user permissions, where users can search in countries where they are admins.

Examples

  • Admin user ESP, only can access ESP loyalty customers

  • Admin user ESP and PT, can access ESP and PT loyalty customers

image-20240606-193508.png

Figma

https://www.figma.com/design/Ti8Qr6jeSEPaencIDyYfcJ/branch/iS2eu3wihqpTUjXoJPXkbK/Burger-King?node-id=1218-356&t=EZP7GwsI6H6Bsmbn-0

Solution

Enhance the existing search bar on the home screen to accept the loyalty ID. Then create a new backend method to communicate with the loyalty API to get the customer cognito ID. With the cognito ID the Admin app can show the customer information correctly.

Tasks breakdown

Schemas/Customer

  • Update the Query with the new method customerByLoyaltyId and update graphQl queries

    image-20240521-201830.png

     

  • Create a new method customerByLoyaltyId inside the Query resolvers section (with the same signature and name of query above)

    • This method should get all the user permissions, and based on this, make requests for each country that this user can access. All this requests, like a promise to be made in parallel

      • To get the User from Loyalty service, will be necessary update this method to override the header x-region

queries/customers

Create a new query inside the customers queries

hooks/use-universal-search

Create a use query for consume the customerByLoyaltyId

Add on the map section the new query

universal-search/searchInstructions

Add new descriptions to this list for loyalty id

The text for loyaltyId already exist in Lokalize, avoiding the necessity of create a new string text.