About / User Stories
Viewpoint: Admin, alle pagina’s worden server-side gerenderd met EJS en MySQL, zonder ORM en zonder async/await.
US-A1 — List & Search actors with pagination
As an Admin, I want to search actors by name and paginate results, so that I can quickly find the right person.
- GET
/actorsshows table sorted by last name, then first name. - Query filters:
qmatchesfirst_nameORlast_name(LIKE %q%). - Pagination via
page(≥1); out-of-range clamps to valid pages; empty results render friendly “no results”.
US-A2 — Create a new actor
As an Admin, I want to add a new actor, so that the catalogue stays up to date.
- GET
/actors/newrenders form; POST/actorsvalidates (first_name,last_namerequired). - On success insert + redirect to details; on validation error re-render with messages, keep entered values.
US-A3 — View actor details
As an Admin, I want to see an actor’s details, so that I can inspect and verify records.
- GET
/actors/:idshowsfirst_name,last_name,last_updateand films the actor appears in. - 404 page if the id does not exist.
US-A4 — Edit an actor
As an Admin, I want to update names, so that data remains correct.
- GET
/actors/:id/editpre-fills form; POST/actors/:id/updatevalidates & updates. last_update=NOW(); redirect to details on success, otherwise re-render with errors.
US-A5 — Delete an actor (with safeguards)
As an Admin, I want to remove actors that are no longer needed, so that the catalogue stays tidy.
- POST
/actors/:id/deleteattempts to delete. - If actor is linked in
film_actor, show a friendly error and do not delete. - On success redirect to list, keeping pagination/search context where possible.
US-B1 — List, filter & paginate films
As an Admin, I want to browse films with quick filters, so that I can find and manage titles.
- GET
/filmslists films with poster, title, language, price and short description. - Filters:
q(title, LIKE),category_id; pagination like actors list. - “Edit/Delete” buttons only when authenticated.
US-B2 — Create a new film (assign actors)
As an Admin, I want to add a film—including linked actors—so that the catalogue grows consistently.
- GET
/films/newshows form with Title, Description, Language, Category, Rental rate (€), Release year, Rating, and multi-select Actors. - Client-side actor search (filter box on the multi-select) to quickly find names.
- POST
/filmsinserts intofilmand related rows infilm_category&film_actorwithin a single connection (callbacks only). - Validation: title required; rental_rate ≥ 0; release_year 1900–2100; rating in allowed set (e.g. G/PG/PG-13/R/NC-17).
US-B3 — View film details
As an Admin, I want to see a film’s details, so that I can verify metadata and cast.
- GET
/films/:idshows all film fields, assigned category, and the list of actors. - 404 if film id does not exist.
US-B4 — Edit a film (incl. cast)
As an Admin, I want to update film data and its cast, so that information stays correct.
- GET
/films/:id/editpre-fills form; search-to-filter for actors; selected items persist. - POST
/films/:id/updateupdatesfilmand replaces joins infilm_actor/film_category(delete + bulk insert).
US-B5 — Delete a film (safe detach)
As an Admin, I want to delete a film safely, so that the list stays relevant.
- POST
/films/:id/deletefirst deletes join rows infilm_actorandfilm_category, then the film. - If the film is referenced by rentals, show a friendly message (no crash) and do not delete.
| Method | Path | Relates to |
|---|---|---|
| GET | /actors | US-A1 |
| GET | /actors/new | US-A2 |
| POST | /actors | US-A2 |
| GET | /actors/:id | US-A3 |
| GET | /actors/:id/edit | US-A4 |
| POST | /actors/:id/update | US-A4 |
| POST | /actors/:id/delete | US-A5 |
| GET | /films | US-B1 |
| GET | /films/new | US-B2 |
| POST | /films | US-B2 |
| GET | /films/:id | US-B3 |
| GET | /films/:id/edit | US-B4 |
| POST | /films/:id/update | US-B4 |
| POST | /films/:id/delete | US-B5 |
- NF-01 Modulariteit — Gelaagde architectuur (routes → controllers → services → repositories), geen cross-layer afhankelijkheden.
- NF-02 Onderhoudbaarheid — DRY: geen duplicatie van SQL/logic; herbruikbare helpers.
- RV-01 JavaScript + MySQL.
- RV-02 SSR met EJS.
- RV-03 Bootstrap-achtig CSS (custom theme).
- RV-04 Open-source waar mogelijk; RV-05 Geen ORM (handgeschreven SQL via npm-package);
- RV-06 Alleen callbacks (geen async/await/Promises) in DB-laag; RV-07 About-pagina (deze) met user-stories & acceptatiecriteria.
- Open
/actorsen verifieer search en pagination (US-A1). - Maak een nieuwe actor via
/actors/new(US-A2); valideer lege invoer. - Open details, pas aan (US-A3/US-A4); probeer te verwijderen (US-A5).
- Bezoek
/films; filter op titel/categorie en pagina’s (US-B1). - Maak een film met cast (US-B2); controleer details en bewerken (US-B3/US-B4); verwijder (US-B5).
- (Optioneel)
/me/rentalstoont historie voor ingelogde gebruiker (Epic C).