Skip to content

Make number of Likes limited to user x post relationship #1

@anlsergio

Description

@anlsergio

The "LikePost" feature allows a single user to add likes to a single post as much as he pleases, so it requires a more complex structure in order to ensure that a post can only be liked once by a single user.

Suggestion:

  • Database: The database requires another table to store Users' foreign keys and Posts' foreign keys in order to create an N x N relationship between Users and Posts (this makes it possible also to add more fancy features like fetching a list of the users that currently like the post);
  • Code: Additional logic must be put in place to validate if a given post is already liked by a given user;
  • Unlike: Of course the "UnlikePost" feature should have the same approach applied so that a single user isn't able to indefinitely unlike a post.

Disclaimer: it's not flagged as a bug because it was thought to be simple initially but it's a great enhancement suggestion for the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions