fix: resolve detekt/ktlint issues blocking CI

Agent-Logs-Url: https://github.com/devitq/movienight-backend/sessions/42b7a686-07a7-41f5-baf7-737b968e12cf

Co-authored-by: devitq <118541411+devitq@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-08 17:48:57 +00:00
committed by GitHub
co-authored by devitq
parent f30488a3d1
commit e91ebb7bd0
6 changed files with 47 additions and 35 deletions
@@ -69,10 +69,11 @@ class UserRepository(
} }
override fun findAll(): List<User> = override fun findAll(): List<User> =
jdbc.query( jdbc
"SELECT id, name, email, provider, provider_id, created_at FROM users", .query(
userEntityRowMapper, "SELECT id, name, email, provider, provider_id, created_at FROM users",
).map { it.toDomain() } userEntityRowMapper,
).map { it.toDomain() }
override fun deleteById(id: UUID) { override fun deleteById(id: UUID) {
jdbc.update("DELETE FROM users WHERE id = ?", id) jdbc.update("DELETE FROM users WHERE id = ?", id)
@@ -84,7 +85,11 @@ class UserRepository(
): User? { ): User? {
val entities = val entities =
jdbc.query( jdbc.query(
"SELECT id, name, email, provider, provider_id, created_at FROM users WHERE provider = ? AND provider_id = ?", """
SELECT id, name, email, provider, provider_id, created_at
FROM users
WHERE provider = ? AND provider_id = ?
""".trimIndent(),
userEntityRowMapper, userEntityRowMapper,
provider.name, provider.name,
providerId, providerId,
@@ -57,10 +57,11 @@ class FilmController(
FilmResponse.fromDomain( FilmResponse.fromDomain(
editFilmUseCase.edit( editFilmUseCase.edit(
id = id, id = id,
command = EditFilmCommand( command =
title = request.title, EditFilmCommand(
description = request.description, title = request.title,
), description = request.description,
),
), ),
) )
@@ -104,12 +104,16 @@ class FilmLibraryController(
@PathVariable userId: UUID, @PathVariable userId: UUID,
): List<FilmResponse> { ): List<FilmResponse> {
val userLibrary = val userLibrary =
try { runCatching {
getFilmLibraryUseCase.getLibrary( getFilmLibraryUseCase.getLibrary(
GetFilmLibraryQuery(userId = userId), GetFilmLibraryQuery(userId = userId),
) )
} catch (e: EntityNotFoundException) { }.getOrElse { exception ->
null if (exception is EntityNotFoundException) {
null
} else {
throw exception
}
} }
val allFilms = getAllFilmsUseCase.getAll() val allFilms = getAllFilmsUseCase.getAll()
@@ -46,14 +46,12 @@ class UserController(
) )
@GetMapping @GetMapping
fun getAll(): List<UserResponse> = fun getAll(): List<UserResponse> = getAllUsersUseCase.getAll().map { UserResponse.fromDomain(it) }
getAllUsersUseCase.getAll().map { UserResponse.fromDomain(it) }
@GetMapping("/{id}") @GetMapping("/{id}")
fun getById( fun getById(
@PathVariable id: UUID, @PathVariable id: UUID,
): UserResponse = ): UserResponse = UserResponse.fromDomain(getUserByIdUseCase.getById(id))
UserResponse.fromDomain(getUserByIdUseCase.getById(id))
@PatchMapping("/{id}") @PatchMapping("/{id}")
fun edit( fun edit(
@@ -63,9 +61,10 @@ class UserController(
UserResponse.fromDomain( UserResponse.fromDomain(
editUserUseCase.edit( editUserUseCase.edit(
id = id, id = id,
command = EditUserCommand( command =
name = request.name, EditUserCommand(
), name = request.name,
),
), ),
) )
@@ -36,15 +36,19 @@ class FilmService(
throw BlockedValueException(target = "Film", field = "description") throw BlockedValueException(target = "Film", field = "description")
} }
val film = Film( val film =
id = idGenerator.generateId(), Film(
title = command.title, id = idGenerator.generateId(),
description = command.description, title = command.title,
) description = command.description,
)
return filmRepository.save(film) return filmRepository.save(film)
} }
override fun edit(id: UUID, command: EditFilmCommand): Film { override fun edit(
id: UUID,
command: EditFilmCommand,
): Film {
if (filmConfig.isBlocked(command.title)) { if (filmConfig.isBlocked(command.title)) {
throw BlockedValueException(target = "Film", field = "title") throw BlockedValueException(target = "Film", field = "title")
} }
@@ -26,18 +26,18 @@ class UserService(
DeleteUserUseCase, DeleteUserUseCase,
GetUserByIdUseCase, GetUserByIdUseCase,
GetAllUsersUseCase { GetAllUsersUseCase {
override fun create(command: CreateUserCommand): User { override fun create(command: CreateUserCommand): User {
if (userConfig.isBlocked(command.name)) { if (userConfig.isBlocked(command.name)) {
throw BlockedValueException(target = "User", field = "name") throw BlockedValueException(target = "User", field = "name")
} }
val user = User( val user =
id = idGenerator.generateId(), User(
name = command.name, id = idGenerator.generateId(),
email = command.email, name = command.name,
library = null, email = command.email,
) library = null,
)
return userRepository.save(user) return userRepository.save(user)
} }
@@ -59,9 +59,8 @@ class UserService(
userRepository.deleteById(id) userRepository.deleteById(id)
} }
override fun getById(id: UUID): User { override fun getById(id: UUID): User =
return userRepository.findById(id) ?: throw EntityNotFoundException(entity = "User", id = id.toString()) userRepository.findById(id) ?: throw EntityNotFoundException(entity = "User", id = id.toString())
}
override fun getAll(): List<User> = userRepository.findAll() override fun getAll(): List<User> = userRepository.findAll()
} }