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

Created and test endorsement API with no authorization #32

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

evelynnchen-cmu
Copy link

@evelynnchen-cmu evelynnchen-cmu commented Oct 7, 2024

Resolves #34

Created API endpoints for endorsing and unendorsing, allowing any logged in user to flip the endorsed boolean field on a post. I took inspiration from bookmark's API.

Edited the following files:

  • src/api/posts.js: connecting the existing postsAPI to the endorse function
  • src/posts/endorsements.js: Changes the database with the new value for endorsed
  • src/posts/index.js: Added in require to route properly
  • src/socket.io/posts/tools.js: Added in here because was not passing other existing test cases.
  • test/posts.js: Developed unit tests to endorse and unendorse a test post.

The current implementation does not check the requesting user's group as that is #26 and I also want to develop incrementally and push out changes to team members to allow for parallel development.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11221437443

Details

  • 27 of 37 (72.97%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 82.657%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/posts/endorsements.js 21 25 84.0%
src/socket.io/posts/tools.js 3 9 33.33%
Totals Coverage Status
Change from base Build 11209356722: -0.03%
Covered Lines: 22369
Relevant Lines: 25635

💛 - Coveralls

Copy link

@AliceeLe AliceeLe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to work. The amount of commit is easy to follow through and the field appears on the JSON file.

@evelynnchen-cmu evelynnchen-cmu added this to the Sprint 2 milestone Oct 8, 2024
@evelynnchen-cmu evelynnchen-cmu merged commit 33a5bea into f24 Oct 8, 2024
1 check passed
@evelynnchen-cmu evelynnchen-cmu deleted the evelynnc/endorsement-backend branch November 13, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create API to toggle endorsed field
3 participants