Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bayang committed May 25, 2023
1 parent f66d5ce commit b48372b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
kotlin("plugin.allopen") version kotlinVersion
kotlin("kapt") version kotlinVersion
id("com.github.node-gradle.node") version "3.5.1"
id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
id("org.jlleitschuh.gradle.ktlint") version "11.3.2"
}

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,22 @@ class ReadingEventsController(
}

@PutMapping(path = ["/reading-events/{id}"])
fun updateReadingEvent(@PathVariable("id") readingEventId: UUID, @RequestBody @Valid readingEvent: UpdateReadingEventDto): ReadingEventDto {
fun updateReadingEvent(
@PathVariable("id")
readingEventId: UUID,
@RequestBody
@Valid
readingEvent: UpdateReadingEventDto
): ReadingEventDto {
return repository.updateReadingEvent(readingEventId, readingEvent)
}

@ApiResponse(responseCode = "204", description = "Deleted the reading event")
@DeleteMapping(path = ["/reading-events/{id}"])
fun deleteEventById(@PathVariable("id") eventId: UUID): ResponseEntity<Unit> {
fun deleteEventById(
@PathVariable("id")
eventId: UUID
): ResponseEntity<Unit> {
repository.deleteReadingEventById(eventId)
return ResponseEntity.noContent().build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ class UserMessagesController(
): Page<UserMessageDto> = userMessageService.find((principal.principal as JeluUser).user, read, messageCategories, pageable)

@PutMapping(path = ["/user-messages/{id}"])
fun updateMessage(@PathVariable("id") messageId: UUID, @RequestBody @Valid updateDto: UpdateUserMessageDto): UserMessageDto {
fun updateMessage(
@PathVariable("id")
messageId: UUID,
@RequestBody
@Valid
updateDto: UpdateUserMessageDto
): UserMessageDto {
return userMessageService.update(messageId, updateDto)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ class UsersController(
fun usernameById(@PathVariable("id") userId: UUID) = mapOf<String, String>("username" to repository.findUserById(userId).login)

@PutMapping(path = ["/users/{id}"])
fun updateUser(@PathVariable("id") userId: UUID, @RequestBody @Valid user: UpdateUserDto, principal: Authentication, session: HttpSession): UserDto {
fun updateUser(
@PathVariable("id")
userId: UUID,
@RequestBody
@Valid
user: UpdateUserDto,
principal: Authentication,
session: HttpSession
): UserDto {
if (principal.principal is JeluUser) {
if ((principal.principal as JeluUser).user.isAdmin || (principal.principal as JeluUser).user.id.value == userId) {
// only admin user can remove or add admin rights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ class CsvImportServiceTest(
Assertions.assertEquals("2018", imported.book.publishedDate)
Assertions.assertNull(imported.book.image)
val u = UserBookUpdateDto(
null, null, null,
null,
null,
null,
BookCreateDto(
image = CalibreMetadataProvider.FILE_PREFIX + "test.jpg"
),
Expand Down

0 comments on commit b48372b

Please sign in to comment.