-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 대표 지역 정보 저장 * feat: 대표 지역 조회 로직 추가 * feat: 대표 지역 조회 API 추가
- Loading branch information
1 parent
76bf8fe
commit 93e9674
Showing
11 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
Submodule server-profile-submodule
updated
from 44e5e6 to 54e5ed
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/celuveat/common/adapter/out/aws/CloudFrontProperty.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.celuveat.common.adapter.out.aws | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
||
@ConfigurationProperties(prefix = "aws.cloudfront") | ||
data class CloudFrontProperty( | ||
val domain: String, | ||
) |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/com/celuveat/region/adapter/in/rest/RegionApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.celuveat.region.adapter.`in`.rest | ||
|
||
import com.celuveat.region.adapter.`in`.rest.response.RepresentativeRegionResponse | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.web.bind.annotation.GetMapping | ||
|
||
@Tag(name = "지역 API") | ||
interface RegionApi { | ||
@Operation(summary = "대표 지역 조회") | ||
@GetMapping("/regions/representative") | ||
fun readRepresentativeRegions(): List<RepresentativeRegionResponse> | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/celuveat/region/adapter/in/rest/RegionController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.celuveat.region.adapter.`in`.rest | ||
|
||
import com.celuveat.region.adapter.`in`.rest.response.RepresentativeRegionResponse | ||
import com.celuveat.region.application.port.`in`.ReadRepresentativeRegionsUseCase | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RequestMapping("/regions") | ||
@RestController | ||
class RegionController( | ||
private val readRepresentativeRegionsUseCase: ReadRepresentativeRegionsUseCase, | ||
) : RegionApi { | ||
|
||
@GetMapping("/representative") | ||
override fun readRepresentativeRegions(): List<RepresentativeRegionResponse> { | ||
return readRepresentativeRegionsUseCase.readRepresentativeRegions() | ||
.map { RepresentativeRegionResponse.from(it) } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/celuveat/region/adapter/in/rest/response/RepresentativeRegionResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.celuveat.region.adapter.`in`.rest.response | ||
|
||
import com.celuveat.region.application.port.`in`.result.RepresentativeRegionResult | ||
|
||
data class RepresentativeRegionResponse( | ||
val name: String, | ||
val imageUrl: String, | ||
) { | ||
companion object { | ||
fun from(result: RepresentativeRegionResult): RepresentativeRegionResponse { | ||
return RepresentativeRegionResponse( | ||
name = result.name, | ||
imageUrl = result.imageUrl, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/com/celuveat/region/adapter/out/static/RegionStaticRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.celuveat.region.adapter.out.static | ||
|
||
import com.celuveat.common.adapter.out.aws.CloudFrontProperty | ||
import com.celuveat.common.annotation.Adapter | ||
import com.celuveat.region.application.port.`in`.result.RepresentativeRegionResult | ||
|
||
@Adapter | ||
class RegionStaticRepository( | ||
property: CloudFrontProperty, | ||
) { | ||
private val representedRegions: List<RepresentativeRegionResult> = listOf( | ||
RepresentativeRegionResult("잠실", "${property.domain}/regions/jamsil.webp"), | ||
RepresentativeRegionResult("성수", "${property.domain}/regions/seongsu.webp"), | ||
RepresentativeRegionResult("홍대", "${property.domain}/regions/hongdae.webp"), | ||
RepresentativeRegionResult("을지로", "${property.domain}/regions/euljiro.webp"), | ||
RepresentativeRegionResult("압구정", "${property.domain}/regions/apgujeong.webp"), | ||
RepresentativeRegionResult("여의도", "${property.domain}/regions/yeouido.webp"), | ||
RepresentativeRegionResult("이태원", "${property.domain}/regions/itaewon.webp"), | ||
) | ||
|
||
fun readRepresentativeRegions(): List<RepresentativeRegionResult> { | ||
return representedRegions | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/celuveat/region/application/RegionQueryService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.celuveat.region.application | ||
|
||
import com.celuveat.region.application.port.`in`.ReadRepresentativeRegionsUseCase | ||
import com.celuveat.region.application.port.`in`.result.RepresentativeRegionResult | ||
import com.celuveat.region.application.port.out.ReadRegionPort | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class RegionQueryService( | ||
private val readRegionPort: ReadRegionPort, | ||
) : ReadRepresentativeRegionsUseCase { | ||
|
||
override fun readRepresentativeRegions(): List<RepresentativeRegionResult> { | ||
return readRegionPort.readRepresentativeRegions() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/celuveat/region/application/port/in/ReadRepresentativeRegionsUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.celuveat.region.application.port.`in` | ||
|
||
import com.celuveat.region.application.port.`in`.result.RepresentativeRegionResult | ||
|
||
interface ReadRepresentativeRegionsUseCase { | ||
fun readRepresentativeRegions(): List<RepresentativeRegionResult> | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/celuveat/region/application/port/in/result/RepresentativeRegionResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.celuveat.region.application.port.`in`.result | ||
|
||
data class RepresentativeRegionResult( | ||
val name: String, | ||
val imageUrl: String, | ||
) |
2 changes: 2 additions & 0 deletions
2
src/main/kotlin/com/celuveat/region/application/port/out/ReadRegionPort.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package com.celuveat.region.application.port.out | ||
|
||
import com.celuveat.region.application.port.`in`.result.RepresentativeRegionResult | ||
import com.celuveat.region.domain.Region | ||
|
||
interface ReadRegionPort { | ||
fun readByName(name: String): List<Region> | ||
fun readRepresentativeRegions(): List<RepresentativeRegionResult> | ||
} |