Fix the MovieDB watchlist bug in a Spring Boot app.
Unlock detailed company stats for this questionUpgrade
The app has a WatchlistController and a WatchlistRepository with all required methods already defined. Fixes needed:
- Add to watchlist: the controller is missing the repository save call.
- Remove from watchlist: the controller is missing the repository delete call.
- Add: reject duplicates with HTTP 400 and message "Movie already in watchlist" when
existsByMovieAndUser(movie, user)is true. - Remove: return HTTP 404 with message "Movie not found in watchlist" when the movie is not in the watchlist.
- Rate limiting with the provided
RateLimitingUtil, which holds aMap<String, List<LocalDateTime>>of user operations: implementregisterOperation(append the current timestamp) andisRateLimited(true if operations in the last 2 minutes exceed the limit), and apply it to the add and remove endpoints, returning HTTP 429 when rate limited.
Expect follow-ups like
- Fix the rate limiting.
- Fix the password length constraints.
Format · 60-minute backend section of the OA; the candidate picks a backend framework at the start.
Also asked as · Fix the broken watchlist feature in a Spring Boot MovieDB application.
Community answers
No answers contributed by the community yet.
Related questions
Fix the bugs in the user watchlist backend of a MovieDB app.In a Spring Boot MVC application, in which layer is the view stored?Related courses

Course

Course
Course
