Ryan/update social routes improvement #422
Closed
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.
Info
Closes #411.
Description
What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.
Currently, the user social media api responses would take in each change for a user one-at-a-time rather than in a bundle, causing there to be multiple responses for one user's multiple updates to their social profiles.
The way that I interpreted this, for instance, was that if some user decided to add, say, their LinkedIn and Facebook to their social medias, two responses would be sent separately to insert a user's LinkedIn and Facebook rather than one response that could easily compile the two, cutting down on the number of function calls.
Changes
socialMedia
(renamed tosocialMedias
and now takes in a list ofSocialMedia
objects rather than just one object) ininsertSocialMediaForUser
(renamed toinsertSocialMediasForUser
plural), multiple arguments ofuuid
(renamed touuids
and now takes in a list ofUuid
objects rather than just one object) andchanges
(param name unchanged, but now takes in list ofPartial<UserSocialMediaModel>
instead of just one) inupdateSocialMediaForUser
(renamed toupdateSocialMediasForUser
plural), and multiple arguments foruuid
(renamed touuids
and now takes in a list ofUuid
objects rather than just one object) indeleteSocialMeidaForUser
(renamed todeleteSocialMediasForUser
plural and return type changed to a list ofPromise<UserSocialMediaModel>
instead of just one).upsertSocialMedia
(renamed toupsertSocialMedias
plural) now takes in a list of changes rather than just one.Type of Change
expected)
workflows, linting, etc.)
Testing
I have tested that my changes fully resolve the linked issue ...
WIP: Need to test changes/change tests such that more cases are checked. For instance, since these operations now take in arrays of changes, we would want it to test for a list of changes such that one is invalid, and have it not perform any changes at all (per clarification from Nikhil on how to handle errors in this sense). Additionally, one thing I still need to check is how the new return type for
deleteSocialMediasForUser
would affect the functionality (this type was changed as it now goes through all valid deletions and performs the deletion operation one-by-one in a loop, but that led to a change that needed to be made to the return type.Checklist
package.json
file.WIP.
Screenshots
Please include a screenshot of your Postman testing passing successfully.
WIP
I should also note that I did accidentally work from changes that I performed from another issue that I had sent a PR for a bit ago (which I am working on fixing the nit), but I can resolve that on my end (PR was #407). Also, this PR right now still needs some work, but I pushed the changes to gauge some more feedback.