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

Implement endpoints for liking/unliking a post #57

Closed
mdar365 opened this issue Mar 10, 2022 · 3 comments · Fixed by #96
Closed

Implement endpoints for liking/unliking a post #57

mdar365 opened this issue Mar 10, 2022 · 3 comments · Fixed by #96
Assignees
Labels
back-end related to back-end code feature New feature
Projects

Comments

@mdar365
Copy link
Contributor

mdar365 commented Mar 10, 2022

Is your feature request related to a problem? Please describe.
Currently we do not have endpoints for liking or unliking posts

Describe the solution you'd like

  • Implement two endpoints: POST /posts/:id/like for liking a post (does not require a body) and DELETE /posts/:id/like for unliking a post. Those endpoints should automatically add/remove entries from the liked-posts table

Add tests for the two endpoints

@mdar365 mdar365 added feature New feature back-end related to back-end code labels Mar 10, 2022
@mdar365 mdar365 added this to To do in Backend-A1 via automation Mar 10, 2022
@LemonPepperSeasoning LemonPepperSeasoning self-assigned this Mar 12, 2022
@harristomyx harristomyx moved this from To do to In progress in Backend-A1 Mar 12, 2022
@mdar365
Copy link
Contributor Author

mdar365 commented Mar 12, 2022

Hey @LemonPepperSeasoning I think this issue might be blocked until #74 is merged since Dylan will be creating the tables for usersLiked

Turns out sequelize can't really deal with arrays after all XD

@mdar365
Copy link
Contributor Author

mdar365 commented Mar 12, 2022

PR has been merged, feel free to work on it now

@Dj5822
Copy link
Contributor

Dj5822 commented Mar 12, 2022

Isn't it supposed to be POST /posts/:id/like for liking a post since we have to create a tuple in order to like a post?

@LemonPepperSeasoning LemonPepperSeasoning linked a pull request Mar 14, 2022 that will close this issue
11 tasks
@harristomyx harristomyx moved this from In progress to Review in progress in Backend-A1 Mar 14, 2022
Backend-A1 automation moved this from Review in progress to Done Mar 15, 2022
LemonPepperSeasoning added a commit that referenced this issue Mar 15, 2022
* Like & unlike endpoint implemented

* Added a test and Fixed a small mistake

* fixed a bug in a unit test

* reorganised the unit test into its own describe function

* Fixed unit test :
- my unit test will not use other endpoint to create model object.
- we directly create a model and only use endpoint that we are testing.

* Fixed a typo in unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end related to back-end code feature New feature
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants