Hello, I’m developing an app where a user can post an image and another user can like it. I have collections of users, posts, and likes.
For each post that a user is viewing, the user can like it, which creates a new record in the Like collection. A user should also be able to unlike it, which is supposed to delete the like it previously created in the Like collection. However, the Like collection does not appear in a button’s delete action list. Like and Post is linked in a one-to-many relationship: one post can have multiple likes from different users.
How can I be able to delete the link a user created?
Hi @bwuzhang ,
If you create many-to-many relationship between posts and likes, there should be an update action with remove like available.
Hi @Yongki , creating likes with many-to-many relationship does not work for me. In this case, when creating a new like, the post field does not even exist, resulting in empty fields in the Collection. The delete option is not available either.
Try update action with add to.
@Yongki Can you elaborate on how to update action with add to? Didn’t have luck poking around.
There are 2 possible approaches to creating “Likes”.
The first one is having many-to-many relationships between Images and Users, so that one Image can be liked by many Users and a User can like many Images.
This is explained here: How to create a "Favorite" button - Adalo Resources
Another approach is having a separate collection to store “Likes” (you can include other data there as well). I’ve made quite a few videos about this in the past - not directly related to your exact case, but approach will be similar:
Hope this helps.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.