Normalize user data and implement user retrieval by ID #1
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
This pull request addresses two main tasks in the resolver module:
normalizeUser
function to convert input user objects from different formats into a uniform schema. Properties from bothuserData1
anduserData2
are mapped to this uniform schema.getUserById
function is now implemented to return a user by their ID from the correct data source. It checks the type of the ID to determine whether to search inuserData1
oruserData2
.userData1
contains UUIDs (strings), whileuserData2
contains numerical IDs.Changes Made
normalizeUser
function to convert input user objects into a uniform schema.getUsers
function to utilize thenormalizeUser
function for each user object before returning the final array of normalized users.getUserById
function to return a user by their ID from the correct data source.resolver.test.ts
to ensure correct functionality ofgetUserById
for both UUIDs and numerical IDs, as well as to verify that the correct data source is used based on the ID type.These changes enhance the resolver module's functionality and ensure consistency in user data representation and retrieval.