Okay my actual like system is kinda energy-intensive regarding api requests. So im going for a fresh start. Ive got a collection movie_liked who gonna store all movie likes. Each document gonna as :
- userID
- movieID My first problem, is how prevent when liking, not have duplicate like for the same user with the same movie ? There no solution without making a check before (listDocument,....) ?
Ideally, I would like to have a single request to like or dislike a movie (like on Youtube, etc...) but I guess for that we need to have a custom backend with custom api request
You can add 1 unique index on userId and movieId
Yeah my bad. But right now I try to create an api route in my NextJS app like this :
/api/user/${userId}/movie/${movieId}/like
for the like, but Ive got an error about user_unauthorized. That weird because its working with function, but not with api routes. I guess its because when using api routes, we dont have the user token to authorize the request
You're right. The session is client side and there is no session server side
Recommended threads
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...