-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(genre): add pagination on scroll
- Loading branch information
Showing
6 changed files
with
97 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- name: genres-by-id | ||
SELECT DISTINCT | ||
(m.id), | ||
m.title, | ||
m.release_date, | ||
m.imdb_id, | ||
(s.id IS NOT NULL) AS "seen" | ||
FROM | ||
movie_genre mg | ||
INNER JOIN movie m ON m.id = mg.movie_id | ||
LEFT JOIN ( SELECT DISTINCT ON (movie_id) | ||
movie_id, | ||
id | ||
FROM | ||
public.seen | ||
WHERE | ||
user_id = $2 | ||
ORDER BY | ||
movie_id, | ||
id) AS s ON m.id = s.movie_id | ||
WHERE | ||
mg.genre_id = $1 | ||
ORDER BY | ||
m.release_date DESC OFFSET $3 | ||
LIMIT 50; | ||
|
||
-- name: genre-by-id | ||
SELECT | ||
name | ||
FROM | ||
genre | ||
WHERE | ||
id = $1; | ||
|
||
-- name: movies-in-genre | ||
SELECT | ||
count(*) | ||
FROM | ||
movie_genre | ||
WHERE | ||
id = $1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.