Version 0.1.3
Last updated: 2023-04-17
Likes
Description
You can now like the movies you love.
Changes
The following changes and implementations have been made in that version of the project:
- Added likes to movies
- Update Prisma schema to have likes in the Movie table
- Each like is a User that gets connected to the like field of the movie. That way the website knows if you liked the movie and displays the button differently
- Big UI overhaul (color palette, structure of movie components)
Features
✅ Likes for movies 👍
✅ New UI ✨
Code
Regarding the code the changes are basically the same as the ones made to implement the save feature. Therefore there will be just pseudo code provided.
So if you want to know how the likes work please refer to the “Version 0.1.2” entry with the following additions.
The UI just included a bunch of css that is to repetitive to explain here.
- Add a another relation between the Movie and the User model with the name
liked_movies
andliked_by
- On the movie page include the same save and unsave function as in “Version 0.1.2”
- In the PageServerLoad function query the database for the length of the array of users that have liked the movie and return it in the props
- To like a movie use the same principal as the save function
- To unlike a movie just delete the connection between the User and the Movie
Commit: Version 0.1.3
Published: 2023-04-03