Skip to content

Feature/#17 google calendar#18

Merged
minseo0313 merged 4 commits into
mainfrom
feature/#17-google-calendar
May 22, 2026
Merged

Feature/#17 google calendar#18
minseo0313 merged 4 commits into
mainfrom
feature/#17-google-calendar

Conversation

@minseo0313
Copy link
Copy Markdown
Collaborator

@minseo0313 minseo0313 commented May 22, 2026

💡 개요

Issue Number: #17

🪐 주요 변경 사항

  • Google Calendar API 연동으로 예약 생성/수정/삭제 시 캘린더 자동 반영
  • CD 워크플로우에 Google Calendar 관련 환경변수 및 credentials 배포 설정 추가

✅ 상세 내용

  • build.gradle에 Google Calendar API 의존성 추가
  • GoogleCalendarService 구현 (이벤트 생성/수정/삭제)
  • Reservation 엔티티에 googleEventId 필드 추가
  • ReservationService에 예약 생성/수정/삭제 시 캘린더 연동 호출
  • application.yml에 Google Calendar 설정 추가
  • CD 워크플로우에서 GOOGLE_CREDENTIALS_JSON Secret을 EC2에 파일로 배포

🔔 참고 사항

  • Google Calendar API 실패 시 예약 자체는 정상 처리됨 (try-catch로 격리)
  • DB에 google_event_id 컬럼 추가 필요: ALTER TABLE reservation ADD COLUMN google_event_id VARCHAR(255);

Google Calendar 통합 기능 추가

변경 목적:
예약 생성/수정/삭제 시 Google Calendar API와 동기화하여 예약 정보를 자동으로 구글 캘린더에 반영합니다. 캘린더 동기화 실패가 예약 작업을 방해하지 않도록 격리하여 처리합니다.

주요 변경 내용:

  • 의존성: Google Calendar API v3 및 관련 라이브러리 3개를 build.gradle에 추가
  • 서비스 계층:
    • GoogleCalendarService 새 클래스 추가 (이벤트 생성/수정/삭제, 크레덴셜 관리)
    • ReservationService에 캘린더 연동 로직 추가 (생성/수정/삭제 시 이벤트 동기화)
  • 엔티티: ReservationgoogleEventId 필드 및 updateGoogleEventId() 메서드 추가
  • 설정:
    • application.ymlgoogle.calendar 설정 블록 추가 (ID, 크레덴셜 경로)
    • .env 파일에 GOOGLE_CALENDAR_ID, GOOGLE_CREDENTIALS_PATH 환경변수 처리
  • 배포: cd.yml 워크플로우에 Google 크레덴셜 환경변수 및 JSON 파일(~/app/google-credentials.json) 배포 로직 추가
  • 예외 처리: ErrorCodeGOOGLE_CALENDAR_SYNC_FAILED 추가
  • VCS: .gitignoredocs/, google-credentials.json 추가

영향 범위:

  • DB 스키마 변경: reservation 테이블에 google_event_id VARCHAR(255) 컬럼 추가 필요
  • 설정 변경: Google Calendar ID 및 크레덴셜 경로 환경변수 설정 필요
  • API 응답 변경: 예약 생성 응답에서 calendar_sync 필드 제거 및 ReservationCreateResponse 클래스 삭제

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

개요

예약 시스템에 Google Calendar API 통합을 추가하여 예약 생성·수정·삭제 시 자동으로 캘린더 이벤트를 동기화하도록 확장되었습니다. 라이브러리 의존성, 애플리케이션 설정, 데이터 모델, 새로운 캘린더 서비스, 그리고 기존 예약 서비스의 통합이 포함되었습니다.

변경 사항

Google Calendar 통합

레이어 / 파일 설명
의존성·설정·배포 환경 구성
build.gradle, src/main/resources/application.yml, .gitignore, .github/workflows/cd.yml
Google Calendar API, OAuth2, HTTP 클라이언트 라이브러리 3종을 추가하고, 환경 변수 기반 캘린더 ID 및 자격증명 경로 설정을 application.yml에 구성합니다. 배포 워크플로우에서 자격증명 JSON을 원격 파일로 저장하고 환경 변수를 전달하도록 확장되었습니다.
Reservation 엔티티 확장 및 에러 처리
src/main/java/com/nailagent/backend/domain/reservation/entity/Reservation.java, src/main/java/com/nailagent/backend/global/exception/ErrorCode.java
Reservation 엔티티에 googleEventId 필드와 updateGoogleEventId() 메서드를 추가하여 Google 이벤트 ID를 추적하고, 동기화 실패 시 사용할 GOOGLE_CALENDAR_SYNC_FAILED 에러 코드를 정의합니다.
GoogleCalendarService 구현
src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java
Google Calendar 클라이언트를 초기화하고, 예약으로부터 이벤트를 생성·수정·삭제하는 메서드들을 구현합니다. 예약의 날짜/시간 정보를 Google 이벤트 형식으로 변환하고, 시간대는 Asia/Seoul로 고정합니다. 클라이언트 초기화 실패 시 로그를 남기고 null로 설정하여 선택적 동기화를 가능하게 합니다.
ReservationService 캘린더 동기화
src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java
GoogleCalendarService를 의존성으로 주입받고, 예약 생성 시 캘린더 이벤트를 생성하여 반환된 이벤트 ID를 저장합니다. 예약 수정·삭제 시 기존 googleEventId가 존재하는 경우에만 조건부로 캘린더를 동기화하여 부분적 동기화 상황을 안전하게 처리합니다.

코드 리뷰 난이도

🎯 3 (중간) | ⏱️ ~25분

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 PR의 핵심 변경사항인 Google Calendar 통합을 명확히 나타내고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#17-google-calendar

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java (1)

101-103: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

트랜잭션 내부의 외부 API 호출은 분리하는 편이 안정적입니다.

현재 예약 트랜잭션 안에서 Google API를 직접 호출하고 있어 DB 트랜잭션 점유 시간이 늘고 장애 전파 가능성이 커집니다. 커밋 이후 동기화(@TransactionalEventListener(phase = AFTER_COMMIT) 또는 outbox)로 분리하는 구조를 권장드립니다.

Also applies to: 153-156, 161-169, 172-179

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`
around lines 101 - 103, The createReservation `@Transactional` method (and other
transactional methods that currently call Google APIs) must not invoke external
APIs inside the DB transaction; instead emit a domain event (e.g.,
ReservationCreatedEvent) or persist an outbox record within the transaction and
move the Google API interaction into an async listener executed AFTER_COMMIT
(use `@TransactionalEventListener`(phase = AFTER_COMMIT) or a separate outbox
processor). Update createReservation to publish the event/outbox instead of
calling the Google API directly, implement a separate listener/worker to perform
the Google API calls and add proper retry/error handling and idempotency there
so API failures do not hold or roll back the DB transaction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/cd.yml:
- Around line 65-66: The created google-credentials.json is left to the system
umask; immediately after writing it with echo "$GOOGLE_CREDENTIALS_JSON" >
~/app/google-credentials.json you must harden permissions by adding chmod 600
~/app/google-credentials.json (do this before appending the path to .env).
Update the workflow lines that reference GOOGLE_CREDENTIALS_JSON /
google-credentials.json to run chmod 600 right after file creation so the file
is only readable/writable by the owner.

In
`@src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java`:
- Around line 32-49: Constructor for GoogleCalendarService currently throws on
init which can stop app startup; wrap the calendar client initialization in a
try-catch inside the GoogleCalendarService constructor to catch Exception, log
the error with context, set a private boolean flag (e.g., enabled = false) and
leave the calendar client null or a safe no-op state so the bean still
constructs. Update all public methods that interact with the calendar
(create/update/delete methods in GoogleCalendarService) to first check the
enabled flag (or null calendar) and return safely (no-op) when disabled,
optionally logging a debug/info message; when initialization succeeds set
enabled = true. Ensure the constructor no longer propagates exceptions so the
application can continue running even if calendar setup fails.
- Around line 51-60: The reserveTime parsing errors are not isolated — only
IOException is caught in createEvent (and the similar blocks at 63-70 and 82-86)
so parsing failures (e.g., split index, LocalTime.parse) can bubble up and roll
back the transaction; change the code to validate the reserveTime format before
parsing and wrap the parsing logic inside buildEvent (or wherever reserveTime is
parsed) with a try-catch that catches parsing/runtime exceptions (e.g.,
DateTimeParseException, IndexOutOfBoundsException, RuntimeException) and handles
them the same as calendar failures: log a clear error including the problematic
reserveTime and exception, and return null (or the same failure signal) instead
of letting the exception propagate; apply the same pattern to the other calendar
methods that call buildEvent (the blocks referenced at lines 63-70 and 82-86,
e.g., updateEvent/deleteEvent) so all calendar-related parsing errors are
isolated.

---

Outside diff comments:
In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`:
- Around line 101-103: The createReservation `@Transactional` method (and other
transactional methods that currently call Google APIs) must not invoke external
APIs inside the DB transaction; instead emit a domain event (e.g.,
ReservationCreatedEvent) or persist an outbox record within the transaction and
move the Google API interaction into an async listener executed AFTER_COMMIT
(use `@TransactionalEventListener`(phase = AFTER_COMMIT) or a separate outbox
processor). Update createReservation to publish the event/outbox instead of
calling the Google API directly, implement a separate listener/worker to perform
the Google API calls and add proper retry/error handling and idempotency there
so API failures do not hold or roll back the DB transaction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e975c83b-a259-48a0-b922-bef2d67f9825

📥 Commits

Reviewing files that changed from the base of the PR and between 41ce59e and d146e46.

📒 Files selected for processing (7)
  • .github/workflows/cd.yml
  • .gitignore
  • build.gradle
  • src/main/java/com/nailagent/backend/domain/reservation/entity/Reservation.java
  • src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java
  • src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java
  • src/main/resources/application.yml

Comment thread .github/workflows/cd.yml
Comment on lines +32 to +49
public GoogleCalendarService(
@Value("${google.calendar.id}") String calendarId,
@Value("${google.calendar.credentials-path}") String credentialsPath,
ResourceLoader resourceLoader
) throws Exception {
this.calendarId = calendarId;

InputStream credentialsStream = resourceLoader.getResource(credentialsPath).getInputStream();
GoogleCredentials credentials = GoogleCredentials
.fromStream(credentialsStream)
.createScoped(List.of(CalendarScopes.CALENDAR));

this.calendar = new Calendar.Builder(
GoogleNetHttpTransport.newTrustedTransport(),
GsonFactory.getDefaultInstance(),
new HttpCredentialsAdapter(credentials)
).setApplicationName("NailAgent").build();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

캘린더 초기화 실패가 전체 애플리케이션 기동 실패로 이어질 수 있습니다.

생성자에서 예외가 나면 빈 생성이 중단되어 예약 기능까지 같이 죽습니다. 캘린더 클라이언트 초기화 실패는 로그 후 비활성 모드로 전환하고, create/update/delete에서 안전하게 no-op 처리하는 방식으로 격리하는 게 좋겠습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java`
around lines 32 - 49, Constructor for GoogleCalendarService currently throws on
init which can stop app startup; wrap the calendar client initialization in a
try-catch inside the GoogleCalendarService constructor to catch Exception, log
the error with context, set a private boolean flag (e.g., enabled = false) and
leave the calendar client null or a safe no-op state so the bean still
constructs. Update all public methods that interact with the calendar
(create/update/delete methods in GoogleCalendarService) to first check the
enabled flag (or null calendar) and return safely (no-op) when disabled,
optionally logging a debug/info message; when initialization succeeds set
enabled = true. Ensure the constructor no longer propagates exceptions so the
application can continue running even if calendar setup fails.

Comment on lines +51 to +60
public String createEvent(Reservation reservation) {
try {
Event event = buildEvent(reservation);
Event created = calendar.events().insert(calendarId, event).execute();
log.info("Google Calendar 이벤트 생성: {}", created.getId());
return created.getId();
} catch (IOException e) {
log.error("Google Calendar 이벤트 생성 실패", e);
return null;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

reserveTime 파싱 예외가 격리되지 않아 예약 처리 자체가 실패할 수 있습니다.

현재는 IOException만 잡고 있어서, 시간 포맷 불일치(split 인덱스/LocalTime.parse) 같은 런타임 예외가 터지면 트랜잭션이 롤백됩니다. 포맷 검증을 추가하고 런타임 파싱 예외도 캘린더 실패로 격리해 주세요.

🛠️ 제안 수정안 (요지)
     public String createEvent(Reservation reservation) {
         try {
             Event event = buildEvent(reservation);
             Event created = calendar.events().insert(calendarId, event).execute();
             log.info("Google Calendar 이벤트 생성: {}", created.getId());
             return created.getId();
-        } catch (IOException e) {
+        } catch (IOException | RuntimeException e) {
             log.error("Google Calendar 이벤트 생성 실패", e);
             return null;
         }
     }
     private Event buildEvent(Reservation reservation) {
         String[] timeRange = reservation.getReserveTime().split("-");
+        if (timeRange.length != 2) {
+            throw new IllegalArgumentException("Invalid reserveTime format: " + reservation.getReserveTime());
+        }
         LocalTime startTime = LocalTime.parse(timeRange[0]);
         LocalTime endTime = LocalTime.parse(timeRange[1]);

Also applies to: 63-70, 82-86

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java`
around lines 51 - 60, The reserveTime parsing errors are not isolated — only
IOException is caught in createEvent (and the similar blocks at 63-70 and 82-86)
so parsing failures (e.g., split index, LocalTime.parse) can bubble up and roll
back the transaction; change the code to validate the reserveTime format before
parsing and wrap the parsing logic inside buildEvent (or wherever reserveTime is
parsed) with a try-catch that catches parsing/runtime exceptions (e.g.,
DateTimeParseException, IndexOutOfBoundsException, RuntimeException) and handles
them the same as calendar failures: log a clear error including the problematic
reserveTime and exception, and return null (or the same failure signal) instead
of letting the exception propagate; apply the same pattern to the other calendar
methods that call buildEvent (the blocks referenced at lines 63-70 and 82-86,
e.g., updateEvent/deleteEvent) so all calendar-related parsing errors are
isolated.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java (1)

58-68: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

createEvent의 예외 처리 방식이 PR 설명의 격리 전략과 다르게 동작해요.

PR 설명에서는 "Calendar API failures are isolated with try-catch so reservations are still processed successfully"라고 명시되어 있는데요, createEventcalendar == null이거나 IOException 발생 시 CustomException을 던지고 있어요. 이렇게 되면 캘린더 연동 실패 시 예약 생성 자체가 실패할 수 있어요.

updateEvent/deleteEvent처럼 격리하려면 예외를 던지지 않고 null을 반환하는 방식으로 통일하거나, 의도적으로 예약 생성 시에만 엄격하게 처리하려는 것이라면 PR 설명을 업데이트해 주시면 좋겠어요.

또한 이전 리뷰에서 언급된 것처럼 buildEvent에서 발생할 수 있는 IllegalArgumentException이나 DateTimeParseException도 격리되지 않고 있어요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java`
around lines 58 - 68, The createEvent method currently throws CustomException on
calendar==null and on IOException, which violates the intended isolation
strategy; modify createEvent (and its use of buildEvent) to catch
calendar==null, IOException, IllegalArgumentException, and
DateTimeParseException, log an appropriate error message (including exception
details) and return null instead of throwing; align behavior with
updateEvent/deleteEvent by treating calendar failures as non-fatal and ensuring
buildEvent parsing errors are also isolated and result in a null return.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`:
- Around line 154-160: The method currently assumes calendar sync succeeded by
always returning calendarSync=true after calling
googleCalendarService.createEvent(reservation); instead check the returned
eventId and set calendarSync = (eventId != null), only call
reservation.updateGoogleEventId(eventId) when eventId is non-null, and pass that
boolean into ReservationCreateResponse.builder().calendarSync(...) so the
response reflects whether createEvent actually returned an ID; refer to
createEvent, updateGoogleEventId, ReservationCreateResponse.builder() and
ReservationService to locate the changes.

---

Duplicate comments:
In
`@src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java`:
- Around line 58-68: The createEvent method currently throws CustomException on
calendar==null and on IOException, which violates the intended isolation
strategy; modify createEvent (and its use of buildEvent) to catch
calendar==null, IOException, IllegalArgumentException, and
DateTimeParseException, log an appropriate error message (including exception
details) and return null instead of throwing; align behavior with
updateEvent/deleteEvent by treating calendar failures as non-fatal and ensuring
buildEvent parsing errors are also isolated and result in a null return.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e1bd5372-da20-452e-8836-f8b784473580

📥 Commits

Reviewing files that changed from the base of the PR and between d146e46 and 91c83b7.

📒 Files selected for processing (6)
  • .github/workflows/cd.yml
  • src/main/java/com/nailagent/backend/domain/reservation/controller/ReservationController.java
  • src/main/java/com/nailagent/backend/domain/reservation/dto/Response/ReservationCreateResponse.java
  • src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java
  • src/main/java/com/nailagent/backend/global/calendar/GoogleCalendarService.java
  • src/main/java/com/nailagent/backend/global/exception/ErrorCode.java

Comment on lines +154 to +160
String eventId = googleCalendarService.createEvent(reservation);
reservation.updateGoogleEventId(eventId);

return ReservationCreateResponse.builder()
.id(reservation.getId())
.calendarSync(true)
.build();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

calendarSync 값이 실제 동기화 결과를 반영하지 않아요.

PR 설명에 따르면 Calendar API 실패 시 try-catch로 예외를 처리한다고 되어 있는데요, 만약 createEvent()가 예외를 잡고 null을 반환하는 경우에도 calendarSync가 항상 true로 응답됩니다. 클라이언트에게 잘못된 정보를 전달할 수 있어요.

updateReservationdeleteReservation에서 googleEventId != null 체크를 하는 것처럼, 여기서도 eventId 존재 여부에 따라 calendarSync 값을 설정하면 더 정확한 응답이 될 것 같아요! 😊

🔧 제안하는 수정 방향
         String eventId = googleCalendarService.createEvent(reservation);
-        reservation.updateGoogleEventId(eventId);
+        if (eventId != null) {
+            reservation.updateGoogleEventId(eventId);
+        }

         return ReservationCreateResponse.builder()
                 .id(reservation.getId())
-                .calendarSync(true)
+                .calendarSync(eventId != null)
                 .build();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`
around lines 154 - 160, The method currently assumes calendar sync succeeded by
always returning calendarSync=true after calling
googleCalendarService.createEvent(reservation); instead check the returned
eventId and set calendarSync = (eventId != null), only call
reservation.updateGoogleEventId(eventId) when eventId is non-null, and pass that
boolean into ReservationCreateResponse.builder().calendarSync(...) so the
response reflects whether createEvent actually returned an ID; refer to
createEvent, updateGoogleEventId, ReservationCreateResponse.builder() and
ReservationService to locate the changes.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java (1)

153-154: ⚡ Quick win

eventId null 체크를 추가하면 다른 메서드들과 일관성이 높아져요.

updateReservationdeleteReservation에서는 googleEventId != null 체크 후 캘린더 API를 호출하는 패턴을 사용하고 있는데요, 여기서도 동일한 패턴을 적용하면 코드 일관성이 좋아지고, createEvent가 실패해서 null을 반환하는 경우 불필요한 메서드 호출을 방지할 수 있어요! 😊

♻️ 제안하는 수정
         String eventId = googleCalendarService.createEvent(reservation);
-        reservation.updateGoogleEventId(eventId);
+        if (eventId != null) {
+            reservation.updateGoogleEventId(eventId);
+        }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`
around lines 153 - 154, Add a null check for the Google Calendar event ID
returned by googleCalendarService.createEvent(...) and only call
reservation.updateGoogleEventId(eventId) when eventId is not null; specifically,
after invoking googleCalendarService.createEvent(reservation) into the local
variable eventId, guard the call to reservation.updateGoogleEventId(eventId)
with a check (eventId != null) so you avoid unnecessary updates when createEvent
fails or returns null and keep behavior consistent with
updateReservation/deleteReservation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java`:
- Around line 153-154: Add a null check for the Google Calendar event ID
returned by googleCalendarService.createEvent(...) and only call
reservation.updateGoogleEventId(eventId) when eventId is not null; specifically,
after invoking googleCalendarService.createEvent(reservation) into the local
variable eventId, guard the call to reservation.updateGoogleEventId(eventId)
with a check (eventId != null) so you avoid unnecessary updates when createEvent
fails or returns null and keep behavior consistent with
updateReservation/deleteReservation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 541656df-5dc1-41b4-a757-314c923a65d1

📥 Commits

Reviewing files that changed from the base of the PR and between 91c83b7 and 395f312.

📒 Files selected for processing (1)
  • src/main/java/com/nailagent/backend/domain/reservation/service/ReservationService.java

@minseo0313 minseo0313 merged commit 374b7cc into main May 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant