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

Ryan/update social routes improvement #422

Closed
wants to merge 5 commits into from

Conversation

ryanDing26
Copy link
Contributor

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

  • Yeah there's a lot lol
  • UserSocialMediaServices.ts functions for insertions, updates, and deletions changed to accept multiple arguments in terms of a user's socialMedia (renamed to socialMedias and now takes in a list of SocialMedia objects rather than just one object) in insertSocialMediaForUser (renamed to insertSocialMediasForUser plural), multiple arguments of uuid (renamed to uuids and now takes in a list of Uuid objects rather than just one object) and changes (param name unchanged, but now takes in list of Partial<UserSocialMediaModel> instead of just one) in updateSocialMediaForUser (renamed to updateSocialMediasForUser plural), and multiple arguments for uuid (renamed to uuids and now takes in a list of Uuid objects rather than just one object) in deleteSocialMeidaForUser (renamed to deleteSocialMediasForUser plural and return type changed to a list of Promise<UserSocialMediaModel> instead of just one).
  • UserSocialMediaRepository.ts functions for upsertSocialMedia (renamed to upsertSocialMedias plural) now takes in a list of changes rather than just one.
  • UserController.ts modified w.r.t. the insertion, update, and deletion method changes in UserSocialMediaServices.ts.

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: idk

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

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

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

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.

Copy link

github-actions bot commented Apr 1, 2024

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.

@nik-dange nik-dange closed this Apr 1, 2024
@nik-dange nik-dange deleted the ryan/update-social-routes-improvement branch May 3, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants