Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 57 additions & 62 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,83 +53,78 @@ dependencies {
testImplementation("com.h2database:h2:2.2.224")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

// Flyway 핵심 라이브러리
implementation("org.flywaydb:flyway-core")
// PostgreSQL 전용 의존성
implementation("org.flywaydb:flyway-database-postgresql")
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xjsr305=strict",
"-Xjvm-default=all"
)
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xjsr305=strict",
"-Xjvm-default=all"
)
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
}
}
}

tasks.withType<Test> {
useJUnitPlatform()
tasks.withType<Test> {
useJUnitPlatform()

}
}


tasks.test {
// 테스트 클래스 1개당 새로운 JVM 프로세스를 띄움 (완전 격리)
forkEvery = 1
tasks.test {
// 테스트 클래스 1개당 새로운 JVM 프로세스를 띄움 (완전 격리)
forkEvery = 1

// 또는 병렬 실행을 꺼서 하나씩 순차적으로 실행되게 보장
maxParallelForks = 1
// 또는 병렬 실행을 꺼서 하나씩 순차적으로 실행되게 보장
maxParallelForks = 1

systemProperty("kotest.framework.classpath.scanning.autoscan.disable", "true")
// JUnit HTML 리포트는 기본적으로 생성됩니다
reports {
html.required.set(true)
junitXml.required.set(true)
systemProperty("kotest.framework.classpath.scanning.autoscan.disable", "true")
// JUnit HTML 리포트는 기본적으로 생성됩니다
reports {
html.required.set(true)
junitXml.required.set(true)
}
finalizedBy(tasks.jacocoTestReport) // 테스트 실행 후 JaCoCo 리포트 생성
}
finalizedBy(tasks.jacocoTestReport) // 테스트 실행 후 JaCoCo 리포트 생성
}

// JaCoCo 설정
jacoco {
toolVersion = "0.8.11"
}
jacoco {
toolVersion = "0.8.11"
}

tasks.jacocoTestReport {
dependsOn(tasks.test) // test 작업 후 실행
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/test/html"))
tasks.jacocoTestReport {
dependsOn(tasks.test) // test 작업 후 실행
reports {
xml.required.set(true)
csv.required.set(false)
html.required.set(true)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/test/html"))
}
// 리포트에 포함할 소스 파일 지정
classDirectories.setFrom(
files(classDirectories.files.map {
fileTree(it) {
exclude(
"**/config/**",
"**/dto/**",
"**/exception/**",
"**/global/**",
"**/domain/**/dto/**",
"**/Application*"
)
}
})
)
}
// 리포트에 포함할 소스 파일 지정
classDirectories.setFrom(
files(classDirectories.files.map {
fileTree(it) {
exclude(
"**/config/**",
"**/dto/**",
"**/exception/**",
"**/global/**",
"**/domain/**/dto/**",
"**/Application*"
)
}
})
)
}

// 테스트 커버리지 검증 작업 (선택사항)
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
limit {
minimum = "0.80".toBigDecimal() // 최소 80% 커버리지 요구
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
limit {
minimum = "0.80".toBigDecimal() // 최소 80% 커버리지 요구
}
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ fun Concert.toConcertSearchResultDto(): ConcertSearchResultDto =
concertId = id,
title = title,
place = place,
latitude = latitude,
longitude = longitude,
posterImageUrl = posterImageUrl?.toString()
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.bandchu.api.domain.artist.dto

import io.swagger.v3.oas.annotations.media.Schema
import java.math.BigDecimal

@Schema(description = "앨범 상세 정보")
data class ConcertSearchResultDto(
@get:Schema(description = "공연명 이름", example = "데이먼스이어 단독콘서트")
Expand All @@ -12,6 +14,12 @@ data class ConcertSearchResultDto(
@get:Schema(description = "공연명 이름", example = "데이먼스이어 단독콘서트")
val place: String,

@get:Schema(description = "위도")
val latitude: BigDecimal?,

@get:Schema(description = "경도")
val longitude: BigDecimal?,

@get:Schema(description = "공연명 이름", example = "데이먼스이어 단독콘서트")
val posterImageUrl: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ class ArtiProfileRepository {
id = this[ConcertTable.id].value,
title = this[ConcertTable.title],
place = this[ConcertTable.place],
latitude = this[ConcertTable.latitude],
longitude = this[ConcertTable.longitude],
posterImageUrl = this[ConcertTable.posterImageUrl]?.let { URI(it) },
information = this[ConcertTable.information],
bookingUrl = this[ConcertTable.bookingUrl]?.let { URI(it) },
bookingSchedule = this[ConcertTable.bookingSchedule],
createdAt = this[ConcertTable.createdAt],
artiProfileId = this[ConcertTable.arti_profile].value
artiProfileId = this[ConcertTable.arti_profile].value,
viewCount = this[ConcertTable.viewCount]
)

private fun ResultRow.toSnsLinkDomain(): SnsLink =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ import org.springframework.web.bind.annotation.*
class ConcertController(
private val concertService: ConcertService
) {
@Operation(summary = "근처 공연 조회", description = "현재 위치 기준 10km 이내, 오늘 스케줄이 있는 공연을 공연 시각 순으로 반환")
@GetMapping("/nearby")
fun getNearby(
@RequestParam lat: Double,
@RequestParam lng: Double
): ResponseEntity<ApiResponse<ConcertListResponse>> {
val concerts = concertService.getNearbyConcerts(lat, lng)

return ResponseEntity
.status(HttpStatus.OK)
.body(ApiResponse.success(concerts.toConcertListResponse()))
}

@Operation(summary = "모든 콘서트 정보 가져오기", description = "한 artist에 대한 모든 콘서트 정보 가져오기")
@GetMapping("")
fun getAll(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ fun Concert.toConcertDetailResponse(): ConcertDetailResponse =
concertId = id,
title = title,
place = place,
latitude = latitude,
longitude = longitude,
posterImageUrl = posterImageUrl?.toString(),
information = information,
bookingUrl = bookingUrl?.toString(),
Expand All @@ -54,6 +56,8 @@ fun Concert.toSubscribedConcertDto(): SubscribedConcertDto =
concertId = this.id,
title = this.title,
place = this.place,
latitude = this.latitude,
longitude = this.longitude,
bookingSchedule = this.bookingSchedule.toString(),
bookingUrl = this.bookingUrl.toString(),
posterImageUrl = this.posterImageUrl.toString(),
Expand Down Expand Up @@ -92,6 +96,8 @@ fun ConcertCreateRequest.toCommand(): CreateConcertCommand =
CreateConcertCommand(
title = title,
place = place,
latitude = latitude,
longitude = longitude,
posterImageUrl = posterImageUrl?.let { URI(it) },
information = information,
bookingUrl = bookingUrl?.let { URI(it) },
Expand All @@ -105,6 +111,8 @@ fun ConcertUpdateRequest.toCommand(concertId: Long): UpdateConcertCommand =
concertId = concertId,
title = title,
place = place,
latitude = latitude,
longitude = longitude,
posterImageUrl = posterImageUrl?.let { URI(it) },
information = information,
bookingUrl = bookingUrl?.let { URI(it) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.bandchu.api.domain.concert.dto

import com.bandchu.api.domain.concert.dto.response.ConcertScheduleResponse
import io.swagger.v3.oas.annotations.media.Schema
import java.math.BigDecimal

@Schema(description = "구독 중인 콘서트 정보")
data class SubscribedConcertDto(
Expand All @@ -11,6 +12,10 @@ data class SubscribedConcertDto(
val title: String,
@get:Schema(description = "콘서트 장소", example = "인천 인스파이어 아레나")
val place: String,
@get:Schema(description = "위도")
val latitude: BigDecimal?,
@get:Schema(description = "경도")
val longitude: BigDecimal?,
@get:Schema(description = "예매 url", example = "http://www.interpark.com")
val bookingUrl: String?,
@get:Schema(description = "콘서트 포스터 이미지 url", example = "http://www.concert.poster.com")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.bandchu.api.domain.concert.dto.request
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.Valid
import jakarta.validation.constraints.NotBlank
import java.math.BigDecimal

@Schema(description = "콘서트 생성 요청")
data class ConcertCreateRequest(
@get:Schema(description = "공연명 이름", example = "데이먼스이어 단독콘서트")
Expand All @@ -13,6 +15,12 @@ data class ConcertCreateRequest(
@field:NotBlank("공연 장소를 입력하세요.")
val place: String,

@get:Schema(description = "위도 (프론트 주소/지도 검색 결과)", example = "37.5665")
val latitude: BigDecimal? = null,

@get:Schema(description = "경도 (프론트 주소/지도 검색 결과)", example = "126.9780")
val longitude: BigDecimal? = null,

@get:Schema(description = "콘서트 포스터 이미지 url", example = "http://www.co.kr")
val posterImageUrl: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.bandchu.api.domain.concert.dto.request
import io.swagger.v3.oas.annotations.media.Schema
import jakarta.validation.Valid
import jakarta.validation.constraints.NotBlank
import java.math.BigDecimal

@Schema(description = "콘서트 정보 업데이트 요청")
data class ConcertUpdateRequest(
@get:Schema(description = "콘서트 이름", example = "실리카겔 단독 콘서트")
Expand All @@ -13,6 +15,12 @@ data class ConcertUpdateRequest(
@field:NotBlank("공연 장소를 입력하세요.")
val place: String,

@get:Schema(description = "위도 (프론트 주소/지도 검색 결과)")
val latitude: BigDecimal? = null,

@get:Schema(description = "경도 (프론트 주소/지도 검색 결과)")
val longitude: BigDecimal? = null,

@get:Schema(description = "콘서트 포스터 이미지 url", example = "http://poster.co.kr")
val posterImageUrl: String?,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bandchu.api.domain.concert.dto.response

import io.swagger.v3.oas.annotations.media.Schema
import java.math.BigDecimal


@Schema(description = "콘서트 세부 사항 응답")
Expand All @@ -11,6 +12,10 @@ data class ConcertDetailResponse(
val title: String,
@get:Schema(description = "콘서트 장소", example = "인천 인스파이어 아레나")
val place: String,
@get:Schema(description = "위도 (클라이언트가 등록 시 전달)", example = "37.5665")
val latitude: BigDecimal?,
@get:Schema(description = "경도 (클라이언트가 등록 시 전달)", example = "126.9780")
val longitude: BigDecimal?,
@get:Schema(description = "포스터 이미지 url", example = "http://www.image.co,.kr")
val posterImageUrl: String?,
@get:Schema(description = "콘서트 관련 정보", example = "이번 콘서트는 올해 하반기 최대 규모 락 밴드 페스티벌입니다.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package com.bandchu.api.domain.concert.model

import java.math.BigDecimal
import java.net.URI
import java.time.OffsetDateTime

data class Concert(
val id: Long,
val title: String,
val place: String,
val latitude: BigDecimal?,
val longitude: BigDecimal?,
val posterImageUrl: URI?,
val information: String?,
val bookingUrl: URI?,
val bookingSchedule: OffsetDateTime?,
val createdAt: OffsetDateTime,
val artiProfileId: Long,
val viewCount: Long,
val schedules: List<ConcertSchedule> = emptyList()
)
Loading
Loading