- Generated SQL queries for actors, films, categories. - Introduced HTTP handlers for actor, film, and category endpoints. - Included utility functions for parsing query parameters and building URLs. - Enabled pagination, filtering, and HAL representation for responses.
45 lines
No EOL
931 B
SQL
45 lines
No EOL
931 B
SQL
-- name: ListFilms :many
|
|
SELECT film_id,
|
|
title,
|
|
description,
|
|
release_year,
|
|
language_id,
|
|
original_language_id,
|
|
rental_duration,
|
|
rental_rate,
|
|
length,
|
|
replacement_cost,
|
|
rating,
|
|
special_features,
|
|
last_update
|
|
FROM film
|
|
ORDER BY film_id ASC
|
|
LIMIT ? OFFSET ?;
|
|
|
|
-- name: CountFilms :one
|
|
SELECT COUNT(*)
|
|
FROM film;
|
|
|
|
-- name: GetFilm :one
|
|
SELECT film_id,
|
|
title,
|
|
description,
|
|
release_year,
|
|
language_id,
|
|
original_language_id,
|
|
rental_duration,
|
|
rental_rate,
|
|
length,
|
|
replacement_cost,
|
|
rating,
|
|
special_features,
|
|
last_update
|
|
FROM film
|
|
WHERE film_id = ?;
|
|
|
|
-- name: ListActorsByFilm :many
|
|
SELECT a.actor_id, a.first_name, a.last_name, a.last_update
|
|
FROM actor a
|
|
JOIN film_actor fa ON fa.actor_id = a.actor_id
|
|
WHERE fa.film_id = ?
|
|
ORDER BY a.last_name ASC, a.first_name ASC; |