fix: address copilot review issues - explicit imports, trailing commas, 404 for not-found search, tests for available-films endpoint

Agent-Logs-Url: https://github.com/devitq/movienight-backend/sessions/60cd9b1b-e3e1-46a1-bfd9-04a75bd0d569

Co-authored-by: devitq <118541411+devitq@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-03 12:02:31 +00:00
committed by GitHub
co-authored by devitq
parent f563c3e7cf
commit b7a246e0b4
6 changed files with 317 additions and 174 deletions
@@ -64,9 +64,10 @@ class FilmLibraryController(
fun getAllFilmsInLibrary(
@PathVariable userId: UUID,
): List<FilmResponse> {
val library = getFilmLibraryUseCase.getLibrary(
GetFilmLibraryQuery(userId = userId),
)
val library =
getFilmLibraryUseCase.getLibrary(
GetFilmLibraryQuery(userId = userId),
)
val film = getFilmByIdUseCase.getById(library.filmId)
return listOf(FilmResponse.fromDomain(film))
}
@@ -102,21 +103,23 @@ class FilmLibraryController(
fun getAvailableFilms(
@PathVariable userId: UUID,
): List<FilmResponse> {
val userLibrary = try {
getFilmLibraryUseCase.getLibrary(
GetFilmLibraryQuery(userId = userId),
)
} catch (e: EntityNotFoundException) {
null
}
val userLibrary =
try {
getFilmLibraryUseCase.getLibrary(
GetFilmLibraryQuery(userId = userId),
)
} catch (e: EntityNotFoundException) {
null
}
val allFilms = getAllFilmsUseCase.getAll()
val availableFilms = if (userLibrary != null) {
allFilms.filter { it.id != userLibrary.filmId }
} else {
allFilms
}
val availableFilms =
if (userLibrary != null) {
allFilms.filter { it.id != userLibrary.filmId }
} else {
allFilms
}
return availableFilms.map { FilmResponse.fromDomain(it) }
}