Closed ryanDing26 closed 7 months ago
Thanks for contributing! If you've made changes to the API's functionality, please make sure to bump the package version—see this guide to semantic versioning for details—and document those changes as appropriate.
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
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 https://github.com/acmucsd/membership-portal/pull/407). Also, this PR right now still needs some work, but I pushed the changes to gauge some more feedback.