From 60659db85f1a612351f254062d785ab6cba4a65d Mon Sep 17 00:00:00 2001 From: sweetRainShin Date: Fri, 15 May 2026 13:50:36 +0900 Subject: [PATCH 1/5] =?UTF-8?q?chore:=20messaging,=20jpa=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=20=EB=AA=A8=EB=93=88=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EC=97=85,=20rest=20Docs=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index df6062d..4d8ad9d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.5.13' id 'io.spring.dependency-management' version '1.1.7' + id 'org.asciidoctor.jvm.convert' version '4.0.0' } group = 'com.firstticket' @@ -46,6 +47,13 @@ repositories { password = githubToken } } + maven { + url = 'https://maven.pkg.github.com/first-ticket/common-jpa' + credentials { + username = githubUser + password = githubToken + } + } maven { url = 'https://maven.pkg.github.com/first-ticket/common-messaging' credentials { @@ -55,8 +63,13 @@ repositories { } } +configurations { + asciidoctorExt +} + ext { set('springCloudVersion', "2025.0.2") + snippetsDir = file("build/generated-snippets") } dependencyManagement { @@ -68,8 +81,8 @@ dependencyManagement { dependencies { // first-ticket 공통 모듈 implementation 'com.first-ticket:common:0.0.4-SNAPSHOT' - implementation 'com.first-ticket:common-jpa:0.0.1-SNAPSHOT' - implementation 'com.first-ticket:common-messaging:0.0.1-SNAPSHOT' + implementation 'com.first-ticket:common-jpa:0.0.2-SNAPSHOT' + implementation 'com.first-ticket:common-messaging:0.0.2-SNAPSHOT' // ── Spring Boot Core & Common ── // implementation 'org.springframework.boot:spring-boot-starter-web' @@ -122,6 +135,7 @@ dependencies { testImplementation 'com.h2database:h2' // Rest Docs + asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor' testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' } @@ -141,5 +155,36 @@ clean { } test { + outputs.dir snippetsDir // 스니펫을 snippetsDir에 저장 useJUnitPlatform() } + +asciidoctor { + inputs.dir snippetsDir + dependsOn test + configurations 'asciidoctorExt' + baseDirFollowsSourceFile() +} + +tasks.named('asciidoctor') { + doFirst { + delete file('src/main/resources/static/docs') + } +} + +tasks.register('copyDocument', Copy) { + dependsOn asciidoctor + from layout.buildDirectory.dir("docs/asciidoc") + into layout.projectDirectory.dir("src/main/resources/static/docs") +} + +tasks.named('build') { + dependsOn copyDocument +} + +bootJar { + dependsOn asciidoctor + from(layout.buildDirectory.dir("docs/asciidoc")) { + into 'static/docs' + } +} From 6f39b5c081a0e67490b11bd618e609ff30e864ca Mon Sep 17 00:00:00 2001 From: sweetRainShin Date: Fri, 15 May 2026 13:52:12 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EB=82=B4=20=EB=8D=B0=EB=93=9C=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=20=EA=B2=80=EC=A6=9D=20=EB=B3=B4=EC=99=84?= =?UTF-8?q?,=20=EC=9D=BC=EB=B6=80=20=EC=98=88=EC=99=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/firstticket/programservice/domain/Program.java | 5 +---- .../com/firstticket/programservice/domain/Schedule.java | 6 +++--- .../domain/service/dto/ScheduleRemainingData.java | 5 ++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/firstticket/programservice/domain/Program.java b/src/main/java/com/firstticket/programservice/domain/Program.java index 38c9cff..61277dc 100644 --- a/src/main/java/com/firstticket/programservice/domain/Program.java +++ b/src/main/java/com/firstticket/programservice/domain/Program.java @@ -263,10 +263,6 @@ private static void validateProgramInfo(String title, String category, String th if (type == null) { throw new ProgramException(ProgramErrorCode.INVALID_PROGRAM_TYPE); } - // region은 생성 시점에 확정되며 이후 변경하지 않는다 - if (region == null || region.isBlank()) { - throw new ProgramException(ProgramErrorCode.INVALID_REGION); - } if (region.length() > 100) { throw new ProgramException(ProgramErrorCode.INVALID_REGION); @@ -275,6 +271,7 @@ private static void validateProgramInfo(String title, String category, String th } private static String normalizeRegion(String region) { + // region은 생성 시점에 확정되며 이후 변경하지 않는다 if (region == null || region.isBlank()) { throw new ProgramException(ProgramErrorCode.INVALID_REGION); } diff --git a/src/main/java/com/firstticket/programservice/domain/Schedule.java b/src/main/java/com/firstticket/programservice/domain/Schedule.java index b09b137..c4288de 100644 --- a/src/main/java/com/firstticket/programservice/domain/Schedule.java +++ b/src/main/java/com/firstticket/programservice/domain/Schedule.java @@ -160,10 +160,10 @@ public void update(LocalDateTime eventStartAt, LocalDateTime eventEndAt, LocalDa LocalDateTime newSaleEnd = (saleEndAt != null) ? saleEndAt : this.saleEndAt; // 새로 입력된 판매 기간이 현재 시각보다 이전이면 차단 - if (newSaleStart.isBefore(currentTime)) { + if (saleStartAt != null && newSaleStart.isBefore(currentTime)) { throw new ProgramException(ProgramErrorCode.INVALID_SALE_PERIOD); } - if (newSaleEnd.isBefore(currentTime)) { + if (saleEndAt != null && newSaleEnd.isBefore(currentTime)) { throw new ProgramException(ProgramErrorCode.INVALID_SALE_PERIOD); } @@ -182,7 +182,7 @@ public void update(LocalDateTime eventStartAt, LocalDateTime eventEndAt, LocalDa // 이미 등록된 스케줄의 eventStartAt이 현재 시각보다 이전일 수 있으므로 // 변경하지 않는다면 과거 시점 판정을 하지 않음 - if (eventStartAt != null && newEventStart.isBefore(LocalDateTime.now())) { + if (eventStartAt != null && newEventStart.isBefore(currentTime)) { throw new ProgramException(ProgramErrorCode.PAST_EVENT_START); } diff --git a/src/main/java/com/firstticket/programservice/domain/service/dto/ScheduleRemainingData.java b/src/main/java/com/firstticket/programservice/domain/service/dto/ScheduleRemainingData.java index cca3b1c..2ca6852 100644 --- a/src/main/java/com/firstticket/programservice/domain/service/dto/ScheduleRemainingData.java +++ b/src/main/java/com/firstticket/programservice/domain/service/dto/ScheduleRemainingData.java @@ -2,6 +2,9 @@ import java.util.UUID; +import com.firstticket.programservice.domain.exception.ProgramErrorCode; +import com.firstticket.programservice.domain.exception.ProgramException; + /** * 좌석 서비스에서 조회한 회차별 잔여 좌석 수 데이터. * SeatProvider를 통해 조회된 결과를 담는다. @@ -13,7 +16,7 @@ public record ScheduleRemainingData( ) { public ScheduleRemainingData { if (scheduleId == null) { - throw new NullPointerException("scheduleId는 null일 수 없습니다."); + throw new ProgramException(ProgramErrorCode.INVALID_SCHEDULE_ID); } if (remainingCount < 0) { throw new IllegalArgumentException("remainingCount는 0 이상이어야 합니다."); From 8972ec15474310d2144e31a4d48f1ab6256d65e7 Mon Sep 17 00:00:00 2001 From: sweetRainShin Date: Fri, 15 May 2026 14:46:22 +0900 Subject: [PATCH 3/5] =?UTF-8?q?chore:=20JpaConfig=20auto=20repository=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20sql=20?= =?UTF-8?q?=EC=8A=A4=ED=82=A4=EB=A7=88=20=EC=A3=BC=EC=84=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infrastructure/config/JpaConfig.java | 16 ++++++++++++++++ .../resources/db/migration/V1__init_program.sql | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/firstticket/programservice/infrastructure/config/JpaConfig.java diff --git a/src/main/java/com/firstticket/programservice/infrastructure/config/JpaConfig.java b/src/main/java/com/firstticket/programservice/infrastructure/config/JpaConfig.java new file mode 100644 index 0000000..ae76d26 --- /dev/null +++ b/src/main/java/com/firstticket/programservice/infrastructure/config/JpaConfig.java @@ -0,0 +1,16 @@ +package com.firstticket.programservice.infrastructure.config; + +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@Configuration +@EntityScan(basePackages = { + "com.firstticket.programservice", + "com.firstticket.common.messaging" +}) +@EnableJpaRepositories(basePackages = { + "com.firstticket.programservice", + "com.firstticket.common.messaging" +}) +public class JpaConfig {} diff --git a/src/main/resources/db/migration/V1__init_program.sql b/src/main/resources/db/migration/V1__init_program.sql index 8bdc1a5..3b5a7d6 100644 --- a/src/main/resources/db/migration/V1__init_program.sql +++ b/src/main/resources/db/migration/V1__init_program.sql @@ -1,7 +1,7 @@ -- ===================================================== -- Program Service — V1 초기 스키마 --- schema: program --- Spring 설정: spring.jpa.properties.hibernate.default_schema=program +-- schema: program.schema +-- Spring 설정: spring.jpa.properties.hibernate.default_schema=program.schema -- ===================================================== -- ── btree_gist 확장 ────────────────────────────────── From 032104cea8457418d031e11d6c290483e8e80bd2 Mon Sep 17 00:00:00 2001 From: sweetRainShin Date: Fri, 15 May 2026 14:47:37 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20correlationId=20=EC=A3=BC=EC=9E=85?= =?UTF-8?q?=20=ED=98=95=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infrastructure/event/ProgramEventPublisherImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/firstticket/programservice/infrastructure/event/ProgramEventPublisherImpl.java b/src/main/java/com/firstticket/programservice/infrastructure/event/ProgramEventPublisherImpl.java index 3b5f88e..33ae1f4 100644 --- a/src/main/java/com/firstticket/programservice/infrastructure/event/ProgramEventPublisherImpl.java +++ b/src/main/java/com/firstticket/programservice/infrastructure/event/ProgramEventPublisherImpl.java @@ -78,7 +78,7 @@ public void publishScheduleCreated(Program program, Schedule schedule, .toList(); Events.publish( - UUID.randomUUID().toString(), + schedule.getId() + "-" + scheduleCreated, "SCHEDULE", schedule.getId(), scheduleCreated, From bd9f193c093b48881aeca05d0049a09623e1ade5 Mon Sep 17 00:00:00 2001 From: sweetRainShin Date: Fri, 15 May 2026 16:14:15 +0900 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20sql=20=EC=8A=A4=ED=82=A4=EB=A7=88?= =?UTF-8?q?=20=EC=A3=BC=EC=84=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/db/migration/V1__init_program.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/db/migration/V1__init_program.sql b/src/main/resources/db/migration/V1__init_program.sql index 3b5a7d6..e9543ca 100644 --- a/src/main/resources/db/migration/V1__init_program.sql +++ b/src/main/resources/db/migration/V1__init_program.sql @@ -1,7 +1,7 @@ -- ===================================================== -- Program Service — V1 초기 스키마 --- schema: program.schema --- Spring 설정: spring.jpa.properties.hibernate.default_schema=program.schema +-- schema: program_schema +-- Spring 설정: spring.jpa.properties.hibernate.default_schema=program_schema -- ===================================================== -- ── btree_gist 확장 ──────────────────────────────────