Skip to content

Commit

Permalink
refactor: Location의 이름 수정 메서드를 dto가 아닌 Location 객체가 들고 있도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Dompoo committed Jul 31, 2024
1 parent f75ed75 commit 8684442
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package dnd11th.blooming.api.dto

import dnd11th.blooming.domain.entity.Location

data class LocationModifyRequest(
val name: String,
) {
fun modifyLocation(location: Location): Location {
location.name = name
return location
}
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class LocationService(
locationRepository.findByIdOrNull(locationId)
?: throw NotFoundException(ErrorType.NOT_FOUND_LOCATION_ID)

val modifyLocation = request.modifyLocation(location)
location.modifyName(request.name)

return LocationResponse.from(modifyLocation)
return LocationResponse.from(location)
}

@Transactional
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/dnd11th/blooming/domain/entity/Location.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ class Location(
this.user = user
user.locations.add(this)
}

fun modifyName(name: String) {
this.name = name
}
}

0 comments on commit 8684442

Please sign in to comment.