diff --git a/src/main/kotlin/com/depromeet/makers/domain/model/Place.kt b/src/main/kotlin/com/depromeet/makers/domain/model/Place.kt index f7e8dd3..bf45eb8 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/model/Place.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/model/Place.kt @@ -2,6 +2,7 @@ package com.depromeet.makers.domain.model data class Place( val address: String, + val name: String?, val longitude: Double, val latitude: Double, ) { @@ -9,10 +10,12 @@ data class Place( address: String, longitude: Double, latitude: Double, + name: String?, ) = copy( address = address, longitude = longitude, latitude = latitude, + name = name, ) companion object { @@ -20,16 +23,19 @@ data class Place( address: String, longitude: Double, latitude: Double, + name: String?, ) = Place( address = address, longitude = longitude, latitude = latitude, + name = name, ) fun emptyPlace() = Place( address = "온라인", longitude = 0.0, latitude = 0.0, + name = null, ) } } diff --git a/src/main/kotlin/com/depromeet/makers/domain/usecase/CreateNewSession.kt b/src/main/kotlin/com/depromeet/makers/domain/usecase/CreateNewSession.kt index c8a0576..242e00a 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/usecase/CreateNewSession.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/usecase/CreateNewSession.kt @@ -21,6 +21,7 @@ class CreateNewSession( val address: String?, val longitude: Double?, val latitude: Double?, + val placeName: String?, ) override fun execute(input: CreateNewSessionInput): Session { @@ -55,6 +56,7 @@ class CreateNewSession( address = input.address, longitude = input.longitude, latitude = input.latitude, + name = input.placeName, ) } } diff --git a/src/main/kotlin/com/depromeet/makers/domain/usecase/UpdateSessionPlace.kt b/src/main/kotlin/com/depromeet/makers/domain/usecase/UpdateSessionPlace.kt index 921eb54..067deb8 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/usecase/UpdateSessionPlace.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/usecase/UpdateSessionPlace.kt @@ -11,6 +11,7 @@ class UpdateSessionPlace( val address: String, val latitude: Double, val longitude: Double, + val name: String?, ) override fun execute(input: UpdateSessionInput): Session { @@ -19,6 +20,7 @@ class UpdateSessionPlace( address = input.address, latitude = input.latitude, longitude = input.longitude, + name = input.name, ) return sessionGateway.save( diff --git a/src/main/kotlin/com/depromeet/makers/infrastructure/db/entity/SessionEntity.kt b/src/main/kotlin/com/depromeet/makers/infrastructure/db/entity/SessionEntity.kt index b3a6796..ade561b 100644 --- a/src/main/kotlin/com/depromeet/makers/infrastructure/db/entity/SessionEntity.kt +++ b/src/main/kotlin/com/depromeet/makers/infrastructure/db/entity/SessionEntity.kt @@ -40,6 +40,9 @@ class SessionEntity private constructor( @Column(name = "latitude") var latitude: Double, + @Column(name = "place_name", nullable = true, columnDefinition = "VARCHAR(255)") + var placeName: String?, + ) { fun toDomain(): Session { return Session( @@ -50,7 +53,7 @@ class SessionEntity private constructor( description = description, startTime = startTime, sessionType = sessionType, - place = Place.newPlace(address, longitude, latitude), + place = Place.newPlace(address, longitude, latitude, placeName), ) } @@ -68,6 +71,7 @@ class SessionEntity private constructor( address = place.address, longitude = place.longitude, latitude = place.latitude, + placeName = place.name, ) } } diff --git a/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/SessionController.kt b/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/SessionController.kt index 450c56a..3b20965 100644 --- a/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/SessionController.kt +++ b/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/SessionController.kt @@ -42,6 +42,7 @@ class SessionController( address = request.address, longitude = request.longitude, latitude = request.latitude, + placeName = request.placeName, ) ) return CreateNewSessionResponse.fromDomain(session) @@ -110,6 +111,7 @@ class SessionController( address = request.address, latitude = request.latitude, longitude = request.longitude, + name = request.placeName, ) ) return UpdateSessionPlaceResponse.fromDomain(updatedSession) diff --git a/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/CreateNewSessionRequest.kt b/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/CreateNewSessionRequest.kt index f6e03cf..763c091 100644 --- a/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/CreateNewSessionRequest.kt +++ b/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/CreateNewSessionRequest.kt @@ -41,5 +41,8 @@ data class CreateNewSessionRequest( @Schema(description = "위도", example = "126.9544") val latitude: Double?, + + @Schema(description = "세션 장소 이름", example = "모두의연구소 강남") + val placeName: String?, ) { } diff --git a/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/UpdateSessionPlaceRequest.kt b/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/UpdateSessionPlaceRequest.kt index 1f67edc..a2c980c 100644 --- a/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/UpdateSessionPlaceRequest.kt +++ b/src/main/kotlin/com/depromeet/makers/presentation/restapi/dto/request/UpdateSessionPlaceRequest.kt @@ -13,4 +13,7 @@ data class UpdateSessionPlaceRequest( @Schema(description = "위도", example = "126.9544") val latitude: Double, + + @Schema(description = "세션 장소 이름", example = "모두의연구소 강남") + val placeName: String?, ) diff --git a/src/main/resources/db/migration/V3__add_place_name.sql b/src/main/resources/db/migration/V3__add_place_name.sql new file mode 100644 index 0000000..4a26208 --- /dev/null +++ b/src/main/resources/db/migration/V3__add_place_name.sql @@ -0,0 +1 @@ +ALTER TABLE session ADD COLUMN `place_name` VARCHAR(255) DEFAULT NULL;