Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

361 fcm develop #369

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open

361 fcm develop #369

wants to merge 30 commits into from

Conversation

rudeh2926
Copy link
Member

@rudeh2926 rudeh2926 commented Sep 20, 2024

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • ApplicationFacade 클래스를 추가하여 애플리케이션 상태 관리 기능을 중앙 집중화했습니다.
    • EventController 클래스를 추가하여 주말 급식 관련 메시지를 전송하는 RESTful 엔드포인트를 구현했습니다.
    • 여러 이벤트 관련 클래스와 인터페이스를 추가하여 알림 전송 기능을 강화했습니다.
  • 변경 사항

    • ApplicationStatusRequest, ClassroomStatusRequest, StatusEarlyReturnRequest 등에서 ids 속성을 idList로 이름 변경했습니다.
    • ChangeApplicationStatusService, ChangeClassroomStatusService, ChangeEarlyReturnStatusService의 로직을 간소화하여 ApplicationFacadeUseCase에 의존하도록 변경했습니다.
  • 버그 수정

    • Firebase Cloud Messaging(FMC) 의존성을 8.1.0에서 9.2.0으로 업데이트했습니다.

@rudeh2926 rudeh2926 self-assigned this Sep 20, 2024
Copy link

coderabbitai bot commented Sep 20, 2024

Walkthrough

이번 변경 사항은 애플리케이션 상태 관리 및 관련 기능을 중앙 집중화하는 새로운 구조를 도입합니다. ApplicationFacade 클래스를 통해 애플리케이션 상태를 처리하는 인터페이스가 추가되었으며, 기존 서비스들은 이 새로운 구조를 활용하여 상태 변경 로직을 간소화했습니다. 또한, 여러 데이터 클래스에서 속성 이름이 변경되었고, Firebase Cloud Messaging 의존성의 버전이 업데이트되었습니다.

Changes

파일 경로 변경 요약
buildSrc/.../DependencyVersions.kt Firebase Cloud Messaging 의존성 버전을 "8.1.0"에서 "9.2.0"으로 업데이트.
src/main/kotlin/dsm/pick2024/domain/application/facade/ApplicationFacade.kt ApplicationFacade 클래스 추가 및 애플리케이션 상태 처리 메서드 구현.
src/main/kotlin/dsm/pick2024/domain/application/port/in/ApplicationFacadeUseCase.kt ApplicationFacadeUseCase 인터페이스 추가 및 상태 처리 메서드 정의.
src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/request/ApplicationStatusRequest.kt ids 속성을 idList로 이름 변경.
src/main/kotlin/dsm/pick2024/domain/application/service/ChangeApplicationStatusService.kt 상태 변경 로직을 ApplicationFacadeUseCase로 위임하여 간소화.
src/main/kotlin/dsm/pick2024/domain/classroom/presentation/dto/request/ClassroomStatusRequest.kt ids 속성을 idList로 이름 변경.
src/main/kotlin/dsm/pick2024/domain/classroom/service/ChangeClassroomStatusService.kt 상태 처리 로직을 handleNohandleOk 메서드로 분리하여 간소화.
src/main/kotlin/dsm/pick2024/domain/earlyreturn/presentation/dto/request/StatusEarlyReturnRequest.kt ids 속성을 idList로 이름 변경.
src/main/kotlin/dsm/pick2024/domain/earlyreturn/service/ChangeEarlyReturnStatusService.kt 상태 변경 로직을 ApplicationFacadeUseCase로 위임하여 간소화.
src/main/kotlin/dsm/pick2024/domain/event/EventController.kt EventController 클래스 추가 및 주말 급식 관련 메시지를 전송하는 메서드 구현.
src/main/kotlin/dsm/pick2024/domain/event/Topic.kt ALL 상수를 Topic 열거형에 추가.
src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEvent.kt SendMessageToApplicationEvent 클래스 추가 및 메시지 전송 메서드 구현.
src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEventPort.kt SendMessageToApplicationEventPort 인터페이스 추가 및 메시지 전송 메서드 정의.
src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt SendMessageToClassroomEvent 클래스 추가 및 메시지 전송 메서드 구현.
src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEventPot.kt SendMessageToClassroomEventPot 인터페이스 추가 및 메시지 전송 메서드 정의.
src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEvent.kt SendMessageToWeekendMealEvent 클래스 추가 및 주말 급식 메시지 전송 메서드 구현.
src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEventPort.kt SendMessageToWeekendMealEventPort 인터페이스 추가 및 메시지 전송 메서드 정의.
src/main/kotlin/dsm/pick2024/domain/notice/service/CreateNoticeService.kt 생성자에 ApplicationEventPublisher 추가.
src/main/kotlin/dsm/pick2024/domain/notification/domain/TopicSubscription.kt userId 속성을 제거하여 데이터 구조 간소화.
src/main/kotlin/dsm/pick2024/domain/notification/entity/TopicSubscriptionJpaEntity.kt userId 속성을 제거하여 엔티티 간소화.
src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEvent.kt execute 메서드에서 userId 매개변수를 제거하고 deviceToken만 사용하도록 변경.
src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEventPort.kt execute 메서드에서 accountId 매개변수를 제거하고 deviceToken만 사용하도록 변경.
src/main/kotlin/dsm/pick2024/domain/notification/mapper/TopicSubscriptionMapper.kt 매핑 함수에서 userId 속성을 제거하여 데이터 구조 간소화.
src/main/kotlin/dsm/pick2024/domain/notification/persistence/TopicSubscriptionPersistenceAdapter.kt queryAllTopicSubscriptionByUserId 메서드를 제거하고 queryAllTopicSubscriptionByDeviceToken 추가.
src/main/kotlin/dsm/pick2024/domain/notification/persistence/repository/TopicSubscriptionRepository.kt findAllByUserId 메서드를 제거하고 findAllByDeviceTokenfindByDeviceToken 추가.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ApplicationFacade
    participant ChangeApplicationStatusService

    User->>ChangeApplicationStatusService: changeStatusApplication(request)
    ChangeApplicationStatusService->>ApplicationFacade: handleStatusOk(idList, adminName, applicationKind)
    ApplicationFacade-->>ChangeApplicationStatusService: status updated
    ChangeApplicationStatusService-->>User: response
Loading

🐰 변화의 기쁨을 노래해요!
새로운 구조로 더 나은 길을 가고,
애플리케이션 상태를 쉽게 관리해요.
Rabbit의 마음으로, 모두 함께 뛰어봐요!
변화의 순간을 즐기며,
앞으로 나아가는 발걸음,
모두가 행복한 길로 나아가요! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 18

Outside diff range and nitpick comments (8)
src/main/kotlin/dsm/pick2024/domain/application/port/in/ApplicationFacadeUseCase.kt (2)

7-7: 함수 시그니처가 적절해 보입니다.

함수 시그니처는 의도된 대로 보이지만, 함수의 목적과 동작을 명확히 하기 위해 문서화를 추가하는 것이 좋겠습니다. 예를 들어, 함수가 어떤 상태를 업데이트하는지, 어떤 종류의 알림을 보내는지 등을 설명할 수 있습니다.


9-9: 함수 시그니처가 적절해 보이지만, 실패한 상태 업데이트에 대해 관리자 이름을 기록하지 않는 이유가 궁금합니다.

handleStatusOk 함수와 마찬가지로, 이 함수의 목적과 동작을 명확히 하기 위해 문서화를 추가하는 것이 좋겠습니다.

그리고 handleStatusOk 함수에서는 관리자 이름을 기록하는데, 이 함수에서는 그렇지 않은 것으로 보입니다. 실패한 상태 업데이트에 대해서는 관리자 이름을 기록할 필요가 없는 이유가 있나요? 일관성을 위해 두 함수 모두 관리자 이름을 기록하거나, 아니면 두 함수 모두 기록하지 않는 것이 좋을 것 같습니다.

src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEvent.kt (1)

16-18: 알림 내용을 설정 파일이나 데이터베이스에서 관리하는 것이 좋겠습니다.

현재 알림의 제목과 내용이 하드코딩되어 있습니다. 향후 알림 내용이 변경될 경우 코드를 수정해야 하므로, 알림 내용을 설정 파일이나 데이터베이스에서 관리하는 것이 유지보수에 더 좋을 것 같습니다.

src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt (1)

30-34: 문자열 템플릿을 활용하여 코드를 간결하게 만들 수 있습니다.

if-else 표현식 대신 문자열 템플릿을 사용하면 코드를 더 간결하게 만들 수 있습니다.

-body = if (status == Status.OK) {
-    "${classroom?.startPeriod}부터 이 가능합동다."
-} else {
-    "신청이 거절되었습니다."  
-}
+body = "${if (status == Status.OK) "${classroom?.startPeriod}부터 이 가능합동다." else "신청이 거절되었습니다."}"
src/main/kotlin/dsm/pick2024/domain/notification/persistence/TopicSubscriptionPersistenceAdapter.kt (1)

25-28: Null 가능한 목록 대신 비어 있는 목록을 반환하는 것이 좋습니다.

Null 가능한 목록을 반환하면 호출자가 적절히 처리하지 않을 경우 Null 포인터 예외가 발생할 수 있습니다. 대신 비어 있는 목록을 반환하는 것이 좋습니다.

이 diff를 적용하여 반환 유형을 변경하세요:

-override fun queryAllTopicSubscriptionByDeviceToken(deviceToken: String): List<TopicSubscription>? {
+override fun queryAllTopicSubscriptionByDeviceToken(deviceToken: String): List<TopicSubscription> {
     return topicSubscriptionRepository.findAllByDeviceToken(deviceToken)
         .map { topicSubscriptionMapper.toDomain(it) }
 }
src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt (2)

32-33: LGTM! 콘솔에 인쇄하는 대신 로거를 사용하는 것이 좋습니다.

구독 작업에 대한 기본 오류 처리 및 로깅을 도입한 것은 좋습니다. 그러나 콘솔에 직접 인쇄하는 대신 로거를 사용하는 것이 좋습니다.


53-54: LGTM! 인쇄 대신 로거를 사용하는 것이 좋습니다.

send 작업에 대한 기본 로깅을 도입한 것은 좋습니다. 그러나 직접 인쇄하는 대신 로거를 사용하는 것이 좋습니다.

src/main/kotlin/dsm/pick2024/domain/notification/service/ChangeSubscribeTopicService.kt (1)

Line range hint 40-49: 'topicSubscription'의 Null 가능성에 대한 예외 처리 필요

topicSubscriptionPort.queryTopicSubscriptionByDeviceTokenAndTopic 메서드가 null을 반환할 수 있는 경우, topicSubscription!!을 사용하면 NullPointerException이 발생할 수 있습니다. 데이터베이스에 해당 구독 정보가 없을 때를 대비하여 null 체크 및 처리 로직을 추가하는 것이 좋습니다.

적용할 수정사항:

 private fun updateTopic(deviceToken: String, topic: Topic, isSubscribed: Boolean) {
     val topicSubscription = topicSubscriptionPort.queryTopicSubscriptionByDeviceTokenAndTopic(
         deviceToken,
         topic
     )
-    topicSubscriptionPort.save(
-        topicSubscription!!.copy(
-            isSubscribed = isSubscribed
-        )
-    )
+    if (topicSubscription != null) {
+        topicSubscriptionPort.save(
+            topicSubscription.copy(
+                isSubscribed = isSubscribed
+            )
+        )
+    } else {
+        // 필요에 따라 새로운 구독 정보를 생성하여 저장
+        val newSubscription = TopicSubscription(
+            deviceToken = deviceToken,
+            topic = topic,
+            isSubscribed = isSubscribed
+        )
+        topicSubscriptionPort.save(newSubscription)
+    }
 }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e1a397d and 97f17ea.

Files selected for processing (32)
  • buildSrc/src/main/kotlin/DependencyVersions.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/facade/ApplicationFacade.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/port/in/ApplicationFacadeUseCase.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/request/ApplicationStatusRequest.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/application/service/ChangeApplicationStatusService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/classroom/presentation/dto/request/ClassroomStatusRequest.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/classroom/service/ChangeClassroomStatusService.kt (3 hunks)
  • src/main/kotlin/dsm/pick2024/domain/earlyreturn/presentation/dto/request/StatusEarlyReturnRequest.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/earlyreturn/service/ChangeEarlyReturnStatusService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/EventController.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/Topic.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEvent.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEventPort.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEventPot.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/notice/SendMessageToNoticeEvent.kt (0 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEvent.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEventPort.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notice/service/CreateNoticeService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/domain/TopicSubscription.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/entity/TopicSubscriptionJpaEntity.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEvent.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEventPort.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/mapper/TopicSubscriptionMapper.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/persistence/TopicSubscriptionPersistenceAdapter.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/persistence/repository/TopicSubscriptionRepository.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/port/out/CommendTopicSubscriptionPort.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/port/out/QueryTopicSubscriptionPort.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/service/ChangeSubscribeTopicService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/notification/service/QueryMySubscribeTopicService.kt (2 hunks)
  • src/main/kotlin/dsm/pick2024/domain/user/service/UserLoginService.kt (1 hunks)
  • src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt (5 hunks)
Files not reviewed due to no reviewable changes (1)
  • src/main/kotlin/dsm/pick2024/domain/event/notice/SendMessageToNoticeEvent.kt
Files skipped from review due to trivial changes (1)
  • src/main/kotlin/dsm/pick2024/domain/classroom/presentation/dto/request/ClassroomStatusRequest.kt
Additional context used
detekt
src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt

[warning] 25-25: The caught exception is swallowed. The original exception could be lost.

(detekt.exceptions.SwallowedException)

Additional comments not posted (36)
src/main/kotlin/dsm/pick2024/domain/event/Topic.kt (1)

4-4: 변경 사항을 승인합니다. 코드베이스에서 새로운 열거형 값의 사용을 확인하세요.

ALL 열거형 값을 추가하는 것은 Topic 열거형으로 표현되는 주제 집합을 확장하고, 애플리케이션 내에서 이벤트를 더 광범위하게 분류하거나 처리할 수 있게 합니다.

변경 사항은 문법과 명명 규칙 측면에서 문제가 없어 보입니다. 그러나 ALL 열거형 값이 Topic 열거형을 사용하는 코드베이스의 다른 부분에 영향을 미칠 수 있으므로, 관련된 모든 코드 경로에서 새로운 열거형 값이 올바르게 처리되는지 확인해야 합니다.

다음 스크립트를 실행하여 열거형 값의 사용을 확인하세요:

Verification successful

변경 사항을 승인합니다. Topic.ALL의 사용이 적절히 구현되었습니다.

코드베이스 전반에 걸쳐 Topic.ALL의 사용이 올바르게 구현되었습니다. ChangeSubscribeTopicServiceQueryMySubscribeTopicService에서 ALL 토픽을 적절히 처리하고 있습니다.

다만, 한 가지 개선 사항을 제안드립니다:

  • CreateSubscribeTopicEvent.kt에서 초기 토픽 목록을 생성할 때 Topic.ALL을 포함시키는 것을 고려해보세요. 이렇게 하면 사용자가 처음부터 모든 토픽을 한 번에 구독하거나 구독 취소할 수 있는 옵션을 가질 수 있습니다.

예시:

val topicList = listOf(
    Topic.ALL,
    Topic.NEW_NOTICE,
    Topic.APPLICATION,
    Topic.CLASS_ROOM,
    Topic.WEEKEND_MEAL
)

이 변경은 선택사항이며, 현재 구현도 충분히 잘 작동할 것으로 보입니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `Topic` 열거형의 `ALL` 값 사용을 확인합니다.

# Test: `Topic.ALL` 사용을 검색합니다. Expect: 열거형 값이 사용된 모든 위치를 확인합니다.
rg --type kotlin -A 5 $'Topic\.ALL'

Length of output: 2289


Script:

#!/bin/bash
# Description: `Topic` 열거형의 사용을 확인하고 `ALL`이 누락된 곳을 찾습니다.

# Test: `Topic` 열거형이 사용된 곳을 검색하되, `ALL`이 포함되지 않은 경우를 찾습니다.
rg --type kotlin -C 10 'Topic\.' | rg -v 'Topic\.ALL'

Length of output: 18393

src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEventPort.kt (1)

1-5: 잘 작성된 인터페이스입니다!

SendMessageToWeekendMealEventPort 인터페이스는 주말 급식 이벤트에 메시지를 보내는 역할을 명확하게 정의하고 있습니다. 인터페이스 이름과 send() 함수의 목적이 명확하게 전달되고 있습니다.

src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEventPort.kt (2)

4-4: accountId 매개변수를 제거한 이유와 그 영향에 대해 설명해 주세요.

execute 메서드에서 accountId 매개변수가 제거되었습니다. 이 변경이 이루어진 이유와 이것이 기능에 미치는 영향을 설명해 주시기 바랍니다. accountId가 토픽 구독에 어떻게 사용되었는지, 그리고 이제 어떻게 처리될 것인지 알고 싶습니다.


4-4: 메서드 시그니처 변경 사항을 코드베이스에서 확인하세요.

execute 메서드의 시그니처가 변경되었습니다. 이 인터페이스를 구현하는 모든 클래스와 이 메서드를 호출하는 모든 코드가 새로운 시그니처와 일치하도록 업데이트되었는지 확인하세요.

다음 스크립트를 실행하여 메서드 사용법을 확인하세요:

Verification successful

메서드 시그니처 변경이 성공적으로 적용되었습니다.

CreateSubscribeTopicEventPort.execute 메서드의 시그니처 변경이 코드베이스 전체에 일관되게 적용되었음을 확인했습니다. 인터페이스 정의, 구현 클래스, 그리고 사용 부분 모두 새로운 시그니처(deviceToken만을 파라미터로 사용)와 일치합니다. 이로 인한 컴파일 오류나 기능적 문제는 없을 것으로 보입니다.

주요 변경 사항:

  • src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEventPort.kt: 인터페이스 정의 업데이트
  • src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEvent.kt: 구현 클래스 메서드 시그니처 업데이트
  • src/main/kotlin/dsm/pick2024/domain/user/service/UserLoginService.kt: 메서드 호출 부분 업데이트

이 변경으로 인한 추가적인 코드 수정은 필요하지 않아 보입니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `execute` 메서드의 모든 호출이 새로운 시그니처와 일치하는지 확인합니다.

# Test: 메서드 사용법을 검색합니다. Expect: 새로운 시그니처의 발생만 있어야 합니다.
rg --type kotlin -A 5 $'CreateSubscribeTopicEventPort.execute'

Length of output: 61


Script:

#!/bin/bash
# Description: CreateSubscribeTopicEventPort 인터페이스와 그 구현 및 사용을 확인합니다.

# Test 1: CreateSubscribeTopicEventPort 인터페이스 검색
echo "=== CreateSubscribeTopicEventPort 인터페이스 검색 ==="
rg --type kotlin "interface CreateSubscribeTopicEventPort"

# Test 2: CreateSubscribeTopicEventPort 구현 검색
echo -e "\n=== CreateSubscribeTopicEventPort 구현 검색 ==="
rg --type kotlin "class .+ : CreateSubscribeTopicEventPort"

# Test 3: CreateSubscribeTopicEventPort 또는 잠재적 구현의 사용 검색
echo -e "\n=== CreateSubscribeTopicEventPort 또는 구현 사용 검색 ==="
rg --type kotlin "CreateSubscribeTopicEventPort|execute\\(.*deviceToken"

Length of output: 1590

src/main/kotlin/dsm/pick2024/domain/application/presentation/dto/request/ApplicationStatusRequest.kt (1)

8-8: 속성 이름 변경을 승인합니다.

ids에서 idList로의 이름 변경은 속성이 ID 목록임을 명시적으로 나타내어 가독성을 향상시킵니다. 변경 사항이 논리적으로 올바르며 데이터 유형이 동일하게 유지됩니다.

그러나 코드베이스 전체에서 이 속성에 대한 모든 참조가 업데이트되었는지 확인하는 것이 중요합니다. 다음 스크립트를 실행하여 idList 속성의 사용법을 확인하세요:

Verification successful

idList 속성 이름 변경이 일관되게 적용되었습니다.

코드베이스 전체에 걸쳐 idList 속성의 사용을 검토한 결과, 이름 변경이 모든 관련 파일에서 일관되게 적용되었음을 확인했습니다. 다음과 같은 사항들이 확인되었습니다:

  • 여러 도메인 (조기 귀가, 교실, 신청 등)에서 idList가 올바르게 사용되고 있습니다.
  • 서비스 레이어와 프레젠테이션 레이어 모두에서 일관된 사용이 확인되었습니다.
  • 이전 이름인 ids의 사용 흔적은 발견되지 않았습니다.

따라서 이 변경사항은 안전하게 적용되었으며, 추가적인 수정이 필요하지 않습니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 코드베이스에서 `idList` 속성의 사용법 확인

# Test: `idList` 속성 사용 검색. Expect: 모든 참조가 업데이트되었음.
rg --type kotlin -A 5 $'idList'

Length of output: 7726

src/main/kotlin/dsm/pick2024/domain/earlyreturn/presentation/dto/request/StatusEarlyReturnRequest.kt (1)

8-8: 속성 이름 변경이 잘 되었습니다!

ids에서 idList로의 속성 이름 변경은 컬렉션 유형을 나타내기 위해 속성 이름에 "List"를 추가하는 명명 규칙을 따르고 있어 더 나은 가독성을 제공합니다.

이전 속성 이름 ids를 참조하는 모든 코드를 새 이름 idList로 업데이트해야 합니다. 다음 스크립트를 실행하여 코드베이스에서 ids 속성의 사용을 확인하세요:

Verification successful

속성 이름 변경이 안전하게 이루어진 것으로 보입니다.

코드베이스 검색 결과, StatusEarlyReturnRequest 클래스의 ids 속성 사용이 발견되지 않았습니다. 이는 ids에서 idList로의 이름 변경이 다른 코드에 영향을 미치지 않았을 가능성이 높다는 것을 의미합니다.

그러나 완전한 확신을 위해 다음 사항을 권장드립니다:

  • 변경된 StatusEarlyReturnRequest 클래스를 사용하는 코드를 수동으로 검토하여 idList 속성이 올바르게 사용되고 있는지 확인하세요.
  • 테스트 코드가 있다면 실행하여 변경으로 인한 예기치 않은 영향이 없는지 확인하세요.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 코드베이스에서 `StatusEarlyReturnRequest` 클래스의 `ids` 속성 사용을 검색합니다.

# Test: `StatusEarlyReturnRequest` 클래스에서 `ids` 속성의 사용을 검색합니다. Expect: 일치하는 항목이 없어야 합니다.
rg --type kotlin -w 'StatusEarlyReturnRequest\(.*ids'

Length of output: 55


Script:

#!/bin/bash
# Description: 'StatusEarlyReturnRequest' 클래스의 사용과 'ids' 속성에 대한 더 넓은 검색을 수행합니다.

# Test 1: 'StatusEarlyReturnRequest' 클래스의 모든 사용을 검색합니다.
echo "Searching for StatusEarlyReturnRequest usage:"
rg --type kotlin 'StatusEarlyReturnRequest'

# Test 2: 'ids' 속성의 모든 사용을 검색합니다.
echo "Searching for 'ids' property usage:"
rg --type kotlin '\bids\b'

# Test 3: 'StatusEarlyReturnRequest'와 관련된 'ids' 사용을 검색합니다.
echo "Searching for 'ids' usage related to StatusEarlyReturnRequest:"
rg --type kotlin -C 5 'StatusEarlyReturnRequest' | rg 'ids'

Length of output: 1601

src/main/kotlin/dsm/pick2024/domain/notification/domain/TopicSubscription.kt (1)

12-12: userId 속성 제거에 대한 영향 확인

TopicSubscription 데이터 클래스에서 userId 속성을 제거하는 것은 데이터 구조를 단순화하는 좋은 방법입니다. 나머지 속성들은 토픽 구독을 나타내기에 충분해 보입니다.

다만, userId 속성 제거가 코드베이스의 다른 부분에 영향을 미칠 수 있으므로 이에 대한 검증이 필요합니다.

userId 속성 제거의 영향을 확인하기 위해 다음 스크립트를 실행해보세요:

Verification successful

TopicSubscription에서 userId 제거는 안전해 보이나, 관련 코드 검토 권장

TopicSubscription 클래스에서 userId 속성을 제거한 것은 해당 클래스에 특화된 변경으로 보입니다. 코드베이스의 다른 부분에서는 여전히 userId를 광범위하게 사용하고 있어, 이 변경이 전체 시스템에 미치는 영향은 제한적일 것으로 판단됩니다.

다만, TopicSubscription과 직접적으로 상호작용하는 코드가 있다면, 제거된 userId 속성에 의존하지 않는지 주의 깊게 검토하시기 바랍니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 코드베이스에서 `userId` 속성 사용 여부 확인

# Test: `userId` 속성 사용 검색. Expect: 사용하는 코드가 없어야 함.
rg --type kotlin $'userId'

Length of output: 20426

src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEventPot.kt (2)

6-13: 인터페이스 정의가 명확합니다!

SendMessageToClassroomEventPot 인터페이스는 교실 이벤트 포트에 메시지를 보내는 역할을 하는 것으로 보입니다. send 함수의 매개변수도 적절하게 정의되어 있습니다.


7-12: 함수 정의가 명확합니다!

send 함수는 4개의 매개변수를 받고 있으며, classroom 매개변수는 nullable로 선언되어 있어 선택적으로 사용할 수 있습니다. 함수의 반환 타입은 명시되어 있지 않지만, 인터페이스의 함수이므로 구현체에서 적절히 처리할 것으로 예상됩니다.

src/main/kotlin/dsm/pick2024/domain/notification/port/out/QueryTopicSubscriptionPort.kt (1)

9-9: 좋아 보입니다!

함수 시그니처와 반환 타입이 적절해 보입니다. 주어진 디바이스 토큰에 대한 구독이 없는 경우를 처리하기 위해 null 가능한 리스트를 반환하는 것은 좋은 방법입니다. 함수 이름도 그 목적을 명확하게 전달하고 있습니다.

src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEventPort.kt (1)

7-15: 인터페이스와 함수가 잘 정의되었습니다!

SendMessageToApplicationEventPort 인터페이스와 send 함수의 이름과 매개변수가 적절하게 정의되었습니다. 함수의 역할과 의도가 명확합니다.

buildSrc/src/main/kotlin/DependencyVersions.kt (1)

14-14: FCM 버전 업데이트를 승인합니다.

FCM 의존성 버전을 8.1.0에서 9.2.0으로 업데이트하는 것은 좋아 보입니다. 하지만 주요 버전 변경이므로 코드베이스에 미치는 영향을 철저히 검증해야 합니다.

다음 스크립트를 실행하여 FCM 사용법을 확인하세요:

Verification successful

FCM 9.2.0 버전과 호환되는 것으로 보입니다.

현재 코드베이스의 FirebaseMessaging 사용법을 검토한 결과, 버전 9.2.0과 호환되는 것으로 보입니다. 주요 API 호출 및 예외 처리가 새 버전에서도 유효할 것으로 예상됩니다.

그러나 최적의 성능과 새로운 기능을 활용하기 위해 다음을 권장합니다:

  • FCM 9.2.0의 공식 변경 로그를 검토하여 새로운 기능이나 개선된 API가 있는지 확인하세요.
  • 가능한 경우, 새 버전의 장점을 최대한 활용할 수 있도록 코드를 최적화하세요.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: FCM 사용법 검증

# Test: FCM 클래스 사용 검색. Expect: 버전 9.2.0과 호환되는 사용법만 존재.
rg --type kotlin -A 5 $'FirebaseMessaging'

Length of output: 2822

src/main/kotlin/dsm/pick2024/domain/notification/entity/TopicSubscriptionJpaEntity.kt (1)

18-18: userId 속성 제거에 대해 확인 필요

TopicSubscriptionJpaEntity 클래스의 생성자에서 userId 속성이 제거되었습니다. 이 변경이 의도적인지 확인하고, 코드베이스에서 userId 속성에 의존하지 않고 구독을 관리할 수 있도록 업데이트되었는지 확인하세요.

다음 스크립트를 실행하여 userId 속성의 사용을 확인하세요:

Verification successful

TopicSubscriptionJpaEntity에서 userId 제거는 의도적인 것으로 보입니다

TopicSubscriptionJpaEntity에서 userId 속성을 제거한 것은 의도적인 변경으로 보이며, 코드베이스의 다른 부분에 부정적인 영향을 미치지 않는 것으로 판단됩니다. userId는 여전히 다른 엔티티와 서비스에서 광범위하게 사용되고 있어, 이 변경은 알림 도메인에 특화된 것으로 보입니다.

이 변경으로 인해 구독 관리 방식이 변경되었을 수 있으며, 다른 식별자를 사용하도록 리팩토링되었을 가능성이 있습니다. 코드베이스의 다른 부분에서 userId의 사용에는 영향을 미치지 않는 것으로 보입니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 코드베이스에서 `userId` 속성의 사용을 검색합니다.

# Test: `userId` 속성의 사용을 검색합니다. Expect: `userId` 속성이 사용되는 위치를 확인합니다.
rg --type kotlin -A 5 $'userId'

Length of output: 82483

src/main/kotlin/dsm/pick2024/domain/notification/persistence/repository/TopicSubscriptionRepository.kt (2)

11-11: 잘 작성되었습니다!

findAllByDeviceToken 함수는 주어진 기기 토큰에 해당하는 모든 TopicSubscriptionJpaEntity 인스턴스를 조회하는 기능을 잘 구현하고 있습니다. 함수 시그니처와 반환 타입이 의도한 기능에 적합하며, Spring Data JPA의 쿼리 메서드 명명 규칙을 잘 따르고 있습니다.


13-13: 잘 작성되었지만, 고유성 제약 조건 추가를 고려해 보세요.

findByDeviceToken 함수는 주어진 기기 토큰에 해당하는 단일 TopicSubscriptionJpaEntity를 조회하는 기능을 잘 구현하고 있습니다. 함수 시그니처와 반환 타입이 의도한 기능에 적합하며, Spring Data JPA의 쿼리 메서드 명명 규칙을 잘 따르고 있습니다.

하지만 이 함수는 주어진 기기 토큰에 대해 오직 하나의 TopicSubscriptionJpaEntity만 존재한다고 가정하고 있습니다. 만약 동일한 기기 토큰을 가진 엔티티가 여러 개 존재한다면, 함수는 처음 찾은 엔티티를 반환할 것이고, 이는 예상치 못한 동작을 야기할 수 있습니다.

따라서 deviceToken 컬럼에 고유성 제약 조건(uniqueness constraint)을 추가하는 것을 고려해 보시기 바랍니다. 이미 추가되어 있다면 무시하셔도 좋습니다.

src/main/kotlin/dsm/pick2024/domain/event/EventController.kt (1)

8-17: 잘 구현되었습니다!

이 클래스는 REST 컨트롤러의 좋은 예시입니다. 의존성 주입을 통해 SendMessageToWeekendMealEventPort 인터페이스를 주입받고, 엔드포인트에서는 해당 인터페이스의 send 메서드를 호출하여 비즈니스 로직을 분리하고 있습니다. 이는 단일 책임 원칙과 의존성 역전 원칙을 잘 따르고 있는 것으로 보입니다.

src/main/kotlin/dsm/pick2024/domain/event/weekendmeal/SendMessageToWeekendMealEvent.kt (1)

8-22: 잘 구현되었습니다!

SendMessageToWeekendMealEvent 컴포넌트는 SendMessageToWeekendMealEventPort 인터페이스를 올바르게 구현하고 있으며, CommendTopicSubscriptionPort를 사용하여 주말 급식 신청에 대한 알림을 보내는 역할을 잘 수행하고 있습니다.

src/main/kotlin/dsm/pick2024/domain/notification/mapper/TopicSubscriptionMapper.kt (2)

15-15: userId 속성 제거를 확인했습니다.

TopicSubscriptionJpaEntity 생성자에서 userId 속성이 제거되었습니다. 이 변경 사항이 의도적이고 전체 시스템 설계와 일치하는지 확인하세요.

userId 속성 제거가 코드베이스에 미치는 영향을 확인하려면 다음 스크립트를 실행하세요:

Verification successful

TopicSubscriptionJpaEntity에서 userId 속성 제거가 확인되었습니다.

TopicSubscriptionJpaEntity에서 userId 속성을 제거한 것은 의도적인 변경으로 보입니다. 이 변경은 TopicSubscription 관련 기능에 국한된 것으로 판단됩니다. 다른 도메인에서는 여전히 userId를 광범위하게 사용하고 있어, 이 변경이 전체 시스템에 부정적인 영향을 미칠 가능성은 낮아 보입니다.

다만, 다음 사항을 권장드립니다:

  • TopicSubscription 관련 기능에 대해 철저한 테스트를 수행하여 예상치 못한 동작이 발생하지 않는지 확인하세요.
  • 이 변경으로 인해 TopicSubscription의 식별 또는 연관 방식이 변경되었다면, 관련 문서를 업데이트하세요.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `userId` 속성을 사용하는 코드를 검색합니다.

# Test: `userId` 속성 사용 검색. Expect: 사용하는 코드가 없어야 합니다.
rg --type kotlin -A 5 $'userId'

Length of output: 82483


25-25: userId 속성 제거를 확인했습니다.

TopicSubscription 생성자에서 userId 속성이 제거되었습니다. 이 변경 사항이 의도적이고 전체 시스템 설계와 일치하는지 확인하세요.

userId 속성 제거가 코드베이스에 미치는 영향을 확인하려면 다음 스크립트를 실행하세요:

Verification successful

TopicSubscription에서 userId 제거가 확인되었습니다.

TopicSubscription 관련 파일들을 검토한 결과, userId 속성이 의도적으로 완전히 제거되었음을 확인했습니다. 이 변경사항은 다음과 같은 특징을 가집니다:

  1. TopicSubscription 도메인에만 국한된 변경으로, 시스템의 다른 부분에는 영향을 미치지 않습니다.
  2. userId 대신 deviceToken을 주요 식별자로 사용하도록 변경되었습니다.
  3. 이 변경은 사용자 ID와 기기별 구독을 분리하는 설계 결정의 일부로 보입니다.
  4. 사용자 ID를 직접 연결하지 않음으로써 개인정보 보호를 강화할 수 있습니다.

이 변경사항은 TopicSubscription 도메인의 기능에 맞게 적절히 구현되었으며, 다른 시스템 부분과의 일관성을 해치지 않습니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `userId` 속성을 사용하는 코드를 검색합니다.

# Test: `userId` 속성 사용 검색. Expect: 사용하는 코드가 없어야 합니다.
rg --type kotlin -A 5 $'userId'

Length of output: 82483


Script:

#!/bin/bash
# Description: `TopicSubscription`과 관련된 파일에서 `userId` 사용을 검색합니다.

# Test: `TopicSubscription` 관련 파일에서 `userId` 사용 검색
rg --type kotlin -g "*TopicSubscription*.kt" "userId"

# Test: `TopicSubscription` 관련 파일 목록 확인
fd "TopicSubscription" --type f --extension kt

Length of output: 897


Script:

#!/bin/bash
# Description: `TopicSubscription` 관련 파일의 내용을 표시합니다.

# Test: 모든 `TopicSubscription` 관련 파일의 내용 표시
for file in $(fd "TopicSubscription" --type f --extension kt); do
    echo "File: $file"
    echo "----------------------------------------"
    cat "$file"
    echo "----------------------------------------"
    echo ""
done

Length of output: 10205

src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt (1)

16-38: 메서드 로직은 명확하고 이해하기 쉽습니다.

send 메서드는 교실 이동 신청 결과에 따라 알림을 전송하는 역할을 합니다. 메서드 파라미터와 내부 로직이 명확하게 구성되어 있어 코드를 이해하기 쉽습니다.

src/main/kotlin/dsm/pick2024/domain/notice/service/CreateNoticeService.kt (2)

9-9: 잘 되었습니다!

ApplicationEventPublisher를 import하는 것은 생성자에 새로운 매개변수를 추가하기 위해 필요합니다.


20-20: 잘 되었습니다!

ApplicationEventPublisher 타입의 새로운 생성자 매개변수 applicationEventPublisher가 올바르게 추가되었습니다. 매개변수 이름은 명명 규칙을 따르고 있으며, 타입은 import 문과 일치합니다. 또한 private으로 표시된 것은 좋은 방법입니다.

src/main/kotlin/dsm/pick2024/domain/notification/service/QueryMySubscribeTopicService.kt (1)

21-31: 변경 사항이 잘 반영되었습니다!

topicList를 도입하여 응답의 주제 순서를 일관되게 유지하는 것은 좋은 방법입니다. 또한 구독을 쿼리할 때 계정 ID 대신 사용자의 기기 토큰을 사용하는 것도 논리적인 변경 사항입니다.

변경 사항을 승인합니다. 다만, 기기 토큰 사용이 코드베이스 전체에서 일관되게 적용되는지 확인하는 것이 좋겠습니다.

다음 스크립트를 실행하여 기기 토큰 사용의 일관성을 확인하세요:

Verification successful

기기 토큰 사용이 일관되게 적용되었습니다.

코드베이스 전체에서 deviceToken의 사용을 검토한 결과, 다음과 같은 점을 확인했습니다:

  1. 사용자 인증, 알림 구독, 메시지 전송 등 여러 도메인에서 일관되게 사용되고 있습니다.
  2. 사용자, 알림, 애플리케이션, 교실 등 다양한 도메인에서 적절하게 활용되고 있습니다.
  3. 사용자 로그인에서 시작하여 여러 서비스와 포트로 논리적으로 흐르고 있습니다.

다만, 일부 위치에서 deviceToken이 null일 수 있음을 고려하여 null 체크를 수행하고 있습니다 (예: user.deviceToken!!). 이는 User 도메인 모델에서 deviceToken이 nullable로 정의된 것과 일치합니다.

전반적으로 deviceToken 사용이 일관되고 적절하게 구현되어 있습니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 코드베이스에서 기기 토큰 사용의 일관성 확인

# Test: 기기 토큰 사용 검색. Expect: 일관된 사용 패턴
rg --type kotlin $'deviceToken'

Length of output: 8031

src/main/kotlin/dsm/pick2024/domain/notification/event/CreateSubscribeTopicEvent.kt (1)

Line range hint 17-42: 변경 사항을 승인합니다. 그러나 userId를 구독 관리에서 제거하는 것이 코드베이스 전체에 미치는 영향을 확인하세요.

userId 대신 deviceToken을 사용하여 구독을 관리하도록 로직을 업데이트한 것은 좋습니다. 하지만 이 변경이 알림 시스템의 다른 부분에 영향을 줄 수 있습니다. 특히 userId를 사용하여 구독 관련 작업을 수행하는 코드가 있는지 확인해야 합니다.

전체 코드베이스에서 이 변경 사항이 일관되게 적용되고 불일치나 버그가 발생하지 않도록 해야 합니다.

다음 스크립트를 실행하여 userId가 구독 관리에서 제거된 영향을 확인하세요:

Verification successful

userId 제거가 성공적으로 이루어졌으며, deviceToken이 일관되게 사용되고 있습니다.

코드베이스 전체를 검토한 결과, 구독 관리 및 알림 시스템에서 userId가 완전히 제거되었음을 확인했습니다. 대신 deviceToken이 일관되게 사용되고 있어, 변경이 성공적으로 이루어졌다고 판단됩니다.

주요 변경 사항:

  • 구독 관련 쿼리와 저장 작업이 모두 deviceToken을 기반으로 수행됩니다.
  • 알림 전송 시 deviceToken이 사용됩니다.
  • 사용자 관련 서비스에서도 deviceToken이 적절히 처리되고 있습니다.

이러한 변경으로 인해 알림 시스템의 일관성이 향상되었으며, 잠재적인 버그나 불일치가 발생할 가능성이 낮아졌습니다. 코드베이스 전반에 걸쳐 이 변경이 잘 적용되어 있어 추가적인 수정이 필요하지 않아 보입니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 전체 코드베이스에서 `userId`를 사용하는 구독 관련 코드를 검색합니다.

# Test: `userId`를 사용하는 `TopicSubscription` 관련 코드를 검색합니다. 
# Expect: `userId` 필드가 제거된 이후에 추가된 코드만 나타나야 합니다.
rg --type kotlin -A 5 $'userId.+TopicSubscription'

Length of output: 49


Script:

#!/bin/bash
# Description: 구독 및 알림 관련 코드에서 `userId` 사용을 포괄적으로 검색합니다.

# Test 1: 구독 관련 코드에서 `userId` 사용을 검색합니다.
echo "=== 구독 관련 코드에서 userId 검색 ==="
rg --type kotlin -i "userId.*subscri" -A 5

# Test 2: 알림 관련 코드에서 `userId` 사용을 검색합니다.
echo "=== 알림 관련 코드에서 userId 검색 ==="
rg --type kotlin -i "userId.*notif" -A 5

# Test 3: `deviceToken`이 새로 사용된 곳을 검색합니다.
echo "=== deviceToken 사용 검색 ==="
rg --type kotlin "deviceToken" -A 5

Length of output: 24686

src/main/kotlin/dsm/pick2024/domain/notification/persistence/TopicSubscriptionPersistenceAdapter.kt (2)

30-33: 변경 사항을 승인합니다!

함수 로직은 올바르고 구현이 정확합니다. 주어진 디바이스 토큰에 대한 단일 토픽 구독을 검색하는 유용한 방법을 제공합니다.


25-28: 변경 사항을 승인합니다. 그러나 코드베이스에서 함수 사용을 확인하세요.

함수 로직은 올바릅니다. 그러나 사용자 ID 기반 검색에서 디바이스 토큰 기반 검색으로 변경되었으므로, 이 함수를 사용하는 모든 부분이 업데이트되었는지 확인하세요.

함수 사용을 확인하려면 다음 스크립트를 실행하세요:

Verification successful

변경 사항이 코드베이스 전체에서 올바르게 적용되었음을 확인했습니다.

queryAllTopicSubscriptionByDeviceToken 함수가 모든 사용 위치에서 새로운 deviceToken 기반 시그니처로 올바르게 사용되고 있습니다. 그러나 다음 사항들을 고려해 보시기 바랍니다:

  1. QueryMySubscribeTopicService에서 non-null 단언 연산자(!!)를 사용하고 있습니다. 이는 잠재적인 런타임 오류를 일으킬 수 있으므로 주의가 필요합니다.
  2. 널 가능한 리스트 대신 빈 리스트를 반환하는 것이 타입 안전성을 높일 수 있습니다. 이를 통해 널 체크의 필요성을 줄이고 코드를 더 안전하게 만들 수 있습니다.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 모든 `queryAllTopicSubscriptionByDeviceToken` 함수 호출이 새로운 시그니처와 일치하는지 확인합니다.

# Test: 함수 사용을 검색합니다. Expect: 새로운 시그니처의 발생만 있어야 합니다.
rg --type kotlin -A 5 $'queryAllTopicSubscriptionByDeviceToken'

Length of output: 3210

src/main/kotlin/dsm/pick2024/domain/user/service/UserLoginService.kt (1)

35-35: createSubscribeTopicEventPort.execute 메서드 시그니처 변경을 코드베이스에서 확인하세요.

createSubscribeTopicEventPort.execute 메서드 호출에서 accountId 매개변수가 제거되었습니다. 이 변경 사항이 코드베이스 전체에서 일관되게 업데이트되었는지 확인하세요.

또한 구독 주제 이벤트를 생성하는 데 accountId가 더 이상 필요하지 않은지 확인하세요. 그렇지 않으면 제거하면 잘못된 동작이 발생할 수 있습니다.

다음 스크립트를 실행하여 메서드 사용법을 확인하세요:

Verification successful

createSubscribeTopicEventPort.execute 메서드 시그니처 변경이 확인되었습니다.

createSubscribeTopicEventPort.execute 메서드에서 accountId 매개변수 제거가 인터페이스와 구현 클래스 모두에서 일관되게 적용되었음을 확인했습니다. 변경사항은 다음과 같습니다:

  • CreateSubscribeTopicEventPort 인터페이스: fun execute(deviceToken: String)
  • CreateSubscribeTopicEvent 구현 클래스: override fun execute(deviceToken: String)

이 변경은 의도적인 설계 결정으로 보이며, 구독 주제 이벤트를 생성하는 데 deviceToken만으로 충분한 것으로 판단됩니다. 코드베이스 전체에서 일관성 있게 적용되었으므로 추가적인 조치가 필요하지 않습니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `createSubscribeTopicEventPort.execute` 메서드의 모든 호출이 새 시그니처와 일치하는지 확인합니다.

# Test: 메서드 사용법을 검색합니다. Expect: 새 시그니처의 발생만 있어야 합니다.
rg --type kotlin -A 5 $'createSubscribeTopicEventPort.execute'

Length of output: 739


Script:

#!/bin/bash
# Description: `createSubscribeTopicEventPort` 인터페이스 또는 클래스 정의를 검색합니다.

# Test: `createSubscribeTopicEventPort`의 정의를 검색합니다.
rg --type kotlin -A 10 'interface\s+createSubscribeTopicEventPort|class\s+createSubscribeTopicEventPort'

# Test: `execute` 메서드의 정의를 검색합니다.
rg --type kotlin -A 5 'fun\s+execute.*deviceToken'

Length of output: 1194

src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt (1)

66-68: LGTM!

함수 서명 변경은 sendMessage의 변경 사항과 일치하며 로직이 그에 따라 업데이트되었습니다.

src/main/kotlin/dsm/pick2024/domain/earlyreturn/service/ChangeEarlyReturnStatusService.kt (3)

6-6: 필요한 의존성 추가

ApplicationFacadeUseCase를 사용하는 데 필요한 import 문이 추가되었습니다. 적절한 의존성 추가입니다.


15-15: 의존성 주입 올바르게 수행

ApplicationFacadeUseCase를 생성자에 주입하여 DI 원칙을 준수하고 있습니다.


23-25: 'admin.name' 전달에 대한 개인정보 보호 검토 필요

handleStatusOk 메서드 호출 시 admin.name을 전달하고 있습니다. 관리자 이름이 외부로 노출될 경우 개인정보 보호 문제가 발생할 수 있으므로, 이 정보의 전달이 필요한지 확인해 주시기 바랍니다.

다음 스크립트를 실행하여 admin.name의 사용처를 확인하고, 전달이 적절한지 검증해 보세요:

src/main/kotlin/dsm/pick2024/domain/application/service/ChangeApplicationStatusService.kt (2)

6-6: 필요한 import 문 추가

ApplicationFacadeUseCase를 사용하기 위해 적절한 import 문이 추가되었습니다.


15-15: 의존성 주입 추가

ApplicationFacadeUseCase를 클래스에 주입하여 관련 기능을 사용할 수 있게 되었습니다.

src/main/kotlin/dsm/pick2024/domain/notification/service/ChangeSubscribeTopicService.kt (2)

23-26: 'Topic.ALL' 처리 로직 추가 확인

request.topicTopic.ALL인 경우를 처리하기 위해 조건문을 추가한 것은 적절합니다. 이를 통해 모든 토픽에 대한 구독 상태를 한 번에 변경할 수 있습니다.


31-38: 'handleSingleTopic' 함수의 로직 검토 완료

단일 토픽의 구독 상태를 업데이트하고, 구독 또는 구독 해지를 수행하는 로직을 별도의 함수로 분리하여 코드의 가독성과 유지보수성이 향상되었습니다.

src/main/kotlin/dsm/pick2024/domain/classroom/service/ChangeClassroomStatusService.kt (1)

Line range hint 67-75: getStatus 함수 호출 시 null 가능성 검사 필요

queryAttendancePort.findByUserId(user.xquareId)가 null을 반환할 수 있습니다. 현재 코드에서는 null 체크 없이 run 블록을 사용하고 있으며, null인 경우 UserNotFoundException을 throw하고 있습니다. 그러나 예외 타입이 적절한지 확인이 필요합니다.

다음 스크립트를 실행하여 findByUserId가 null을 반환하는 상황이 올바르게 처리되고 있는지 확인하세요.

Verification successful

findByUserId 메서드의 null 처리가 적절히 구현되어 있습니다

QueryAttendancePort 인터페이스에서 findByUserId 메서드는 명시적으로 nullable 타입 (Attendance?)을 반환하도록 정의되어 있습니다. AttendancePersistenceAdapter의 구현에서는 let 함수를 사용하여 null이 아닌 경우에만 도메인 객체로 변환하고 있습니다.

ChangeClassroomStatusService에서 사용된 safe call 연산자 ?.?: throw UserNotFoundException 구문은 이러한 null 가능성을 적절히 처리하고 있습니다.

따라서 현재 구현은 findByUserId가 null을 반환할 수 있는 상황을 올바르게 처리하고 있습니다.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: findByUserId 호출 결과가 null인 경우 예외 처리가 적절한지 확인
rg --type kotlin 'fun findByUserId' -A 5

Length of output: 14586

fun queryAllTopicSubscriptionByUserId(userId: String): List<TopicSubscription>?
fun queryAllTopicSubscriptionByDeviceToken(deviceToken: String): List<TopicSubscription>?

fun queryTopicSubscriptionByDeviceToken(deviceToken: String): TopicSubscription
Copy link

Choose a reason for hiding this comment

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

null 가능한 반환 타입 또는 옵셔널 타입을 사용하는 것이 좋습니다.

함수 시그니처는 적절해 보이지만, 주어진 디바이스 토큰에 대한 구독이 없는 경우를 처리하기 위해 TopicSubscription?과 같은 null 가능한 반환 타입이나 옵셔널 타입을 사용하는 것이 좋습니다. 현재 구현에서는 구독이 없는 경우 예외가 발생하거나 유효하지 않은 TopicSubscription이 반환될 수 있습니다.

notification: Notification
token: String,
notification: Notification,
isSubscribed: Boolean
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

isSubscribed 대신 isSubmitted 매개변수가 사용되고 있습니다.

FcmUtil 클래스의 sendMessage 함수에서 isSubscribed 대신 isSubmitted라는 Boolean 매개변수가 사용되고 있습니다. 이 매개변수는 예상대로 메시지 전송 여부를 제어하는 데 사용되고 있습니다.

  • src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt 파일의 sendMessage 함수를 확인하세요.
  • CommendTopicSubscriptionPort 인터페이스와 FcmUtil 클래스에서 매개변수 이름을 일치시키는 것이 좋습니다.

코드의 일관성과 가독성을 위해 다음 사항을 고려해 보세요:

  1. CommendTopicSubscriptionPort 인터페이스에서 isSubscribed를 isSubmitted로 변경하거나,
  2. FcmUtil 클래스에서 isSubmitted를 isSubscribed로 변경하세요.

또한, 이 변경이 다른 부분에 미치는 영향을 확인하고 필요한 경우 관련 문서를 업데이트하세요.

Analysis chain

새로운 isSubscribed 매개변수의 사용법을 확인하세요.

isSubscribed라는 새로운 Boolean 매개변수가 추가되었습니다. 이는 메시지 전송 동작이 구독 상태에 따라 달라질 수 있음을 시사합니다. 함수 구현과 사용법이 이 새로운 플래그를 적절하게 처리하도록 업데이트되었는지 확인하세요.

다음 스크립트를 실행하여 isSubscribed 매개변수의 사용법을 확인하세요:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `isSubscribed` 매개변수가 `sendMessage` 함수 내에서 사용되는지 확인합니다.

# Test: 함수 구현에서 `isSubscribed` 사용을 검색합니다. Expect: `isSubscribed`가 함수 로직에 사용되어야 합니다.
ast-grep --lang kotlin --pattern $'fun sendMessage($_, $_, isSubscribed: Boolean) {
  $$$
  isSubscribed
  $$$
}'

Length of output: 114


Script:

#!/bin/bash
# Search for sendMessage function in Kotlin files
echo "Searching for sendMessage function:"
rg "fun\s+sendMessage" -t kotlin

# Search for implementations of CommendTopicSubscriptionPort
echo "Searching for CommendTopicSubscriptionPort implementations:"
rg "class.*:\s*CommendTopicSubscriptionPort" -t kotlin

Length of output: 979


Script:

#!/bin/bash
# Display the content of the sendMessage function in FcmUtil class
echo "Content of sendMessage function in FcmUtil class:"
rg "override fun sendMessage\(.*\)[\s\S]*?^\s*\}" -U --multiline -t kotlin src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt

# Check if isSubscribed is used within the implementation
echo "Checking usage of isSubscribed parameter:"
rg "override fun sendMessage\(.*isSubscribed.*\)[\s\S]*?isSubscribed" -U --multiline -t kotlin src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt

Length of output: 495


Script:

#!/bin/bash
# FcmUtil.kt 파일의 전체 내용 표시
echo "FcmUtil.kt 파일의 전체 내용:"
cat src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt

Length of output: 3785

@@ -5,8 +5,9 @@

interface CommendTopicSubscriptionPort {
fun sendMessage(
token: List<String>,
notification: Notification
token: String,
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

sendMessage 함수의 구현과 사용에 불일치가 있습니다.

코드베이스 검토 결과, sendMessage 함수의 구현과 사용에 몇 가지 문제점이 발견되었습니다:

  1. FcmUtil 클래스의 구현에서 매개변수 이름이 isSubmitted로 되어 있지만, 인터페이스에서는 isSubscribed로 정의되어 있습니다.

  2. SendMessageToClassroomEventSendMessageToApplicationEvent 클래스에서 sendMessage 함수 호출 시 새로 추가된 세 번째 매개변수(isSubscribed 또는 isSubmitted)를 포함하지 않고 있습니다.

다음 작업을 수행하여 이 문제를 해결해야 합니다:

  • FcmUtil 클래스에서 isSubmitted 매개변수 이름을 isSubscribed로 변경하세요.
  • SendMessageToClassroomEventSendMessageToApplicationEvent 클래스에서 sendMessage 함수 호출 시 세 번째 매개변수를 추가하세요.

이러한 불일치를 해결하지 않으면 런타임 오류나 예기치 않은 동작이 발생할 수 있습니다.

Analysis chain

token 매개변수 변경 사항을 코드베이스에서 확인하세요.

token 매개변수의 타입이 List<String>에서 String으로 변경되었습니다. 이는 이제 함수가 여러 토큰 대신 단일 토큰을 받아들인다는 것을 나타냅니다. 코드베이스 전체에서 이 변경 사항이 일관되게 업데이트되었는지 확인하세요.

다음 스크립트를 실행하여 sendMessage 함수의 사용법을 확인하세요:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: `sendMessage` 함수의 모든 호출이 새로운 시그니처와 일치하는지 확인합니다.

# Test: 함수 사용법을 검색합니다. Expect: 새로운 시그니처의 발생만 있어야 합니다.
rg --type kotlin -A 5 $'sendMessage'

Length of output: 114


Script:

#!/bin/bash
# Description: Verify the existence and usage of sendMessage function

# Search for sendMessage function definition
echo "Searching for sendMessage function definition:"
ast-grep --lang kotlin --pattern 'fun sendMessage($_, $_, $_) {
  $$$
}'

# Search for sendMessage usage with a flexible pattern
echo "Searching for sendMessage usage:"
rg --type kotlin 'sendMessage\s*\('

# Look for implementations of CommendTopicSubscriptionPort
echo "Searching for CommendTopicSubscriptionPort implementations:"
ast-grep --lang kotlin --pattern 'class $_ : CommendTopicSubscriptionPort {
  $$$
}'

Length of output: 1311


Script:

#!/bin/bash
# Description: Verify CommendTopicSubscriptionPort implementation and usage

# Check CommendTopicSubscriptionPort interface definition
echo "CommendTopicSubscriptionPort interface definition:"
cat src/main/kotlin/dsm/pick2024/domain/notification/port/out/CommendTopicSubscriptionPort.kt

# Check usage in SendMessageToClassroomEvent
echo "Usage in SendMessageToClassroomEvent:"
rg --type kotlin -A 5 'commendTopicSubscriptionPort.sendMessage' src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt

# Check usage in SendMessageToApplicationEvent
echo "Usage in SendMessageToApplicationEvent:"
rg --type kotlin -A 5 'commendTopicSubscriptionPort.sendMessage' src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEvent.kt

# Look for potential implementations of CommendTopicSubscriptionPort
echo "Potential CommendTopicSubscriptionPort implementations:"
rg --type kotlin 'class.*:.*CommendTopicSubscriptionPort'

Length of output: 2051


Script:

#!/bin/bash
# Description: Verify FcmUtil implementation and full function calls in event classes

# Check FcmUtil implementation
echo "FcmUtil implementation of sendMessage:"
rg --type kotlin -A 10 'override fun sendMessage' src/main/kotlin/dsm/pick2024/infrastructure/util/FcmUtil.kt

# Check full function call in SendMessageToClassroomEvent
echo "Full function call in SendMessageToClassroomEvent:"
rg --type kotlin -A 10 'commendTopicSubscriptionPort.sendMessage' src/main/kotlin/dsm/pick2024/domain/event/classroom/SendMessageToClassroomEvent.kt

# Check full function call in SendMessageToApplicationEvent
echo "Full function call in SendMessageToApplicationEvent:"
rg --type kotlin -A 10 'commendTopicSubscriptionPort.sendMessage' src/main/kotlin/dsm/pick2024/domain/event/application/SendMessageToApplicationEvent.kt

Length of output: 2061

classroom: Classroom?,
isSubscribed: Boolean
) {
println("여까지는 왔다")
Copy link

Choose a reason for hiding this comment

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

디버깅용 코드는 제거하는 것이 좋습니다.

println("여까지는 왔다") 코드는 디버깅 목적으로 사용된 것으로 보입니다. 불필요한 로그 출력은 성능에 영향을 줄 수 있으므로, 제거하는 것이 좋습니다.

-println("여까지는 왔다")
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
println("여까지는 왔다")

Comment on lines +16 to +36
override fun send(
deviceToken: String,
status: Status,
applicationKind: ApplicationKind,
application: Application?,
isSubscribed: Boolean
) {
commendTopicSubscriptionPort.sendMessage(
deviceToken,
Notification(
topic = Topic.APPLICATION,
title = "${if (applicationKind.name == ApplicationKind.APPLICATION.name) "외출" else "조기귀가"} 신청이 " +
"${if (status == Status.OK) "수락" else "거절"}되었습니다.",
body = when (status) {
Status.OK -> "${application?.start}부터 이용 가능합니다."
else -> "신청이 거절되었습니다."
}
),
isSubscribed
)
}
Copy link

Choose a reason for hiding this comment

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

application이 null인 경우에 대한 처리를 추가하세요.

application 매개변수가 null인 경우 application?.start에서 NPE가 발생할 수 있습니다. 이를 방지하기 위해 application이 null인 경우에 대한 처리를 추가하는 것이 좋겠습니다.

예를 들어, 다음과 같이 수정할 수 있습니다:

Status.OK -> application?.start?.let { "$it부터 이용 가능합니다." } ?: "신청이 수락되었습니다."

idList.forEach { id ->
val application = findApplicationById(id, applicationKind)
queryAndSendMessage(application.userId, Status.NO, applicationKind, null)
deleteApplicationPort.deleteByIdAndApplicationKind(application.id!!, applicationKind)
Copy link

Choose a reason for hiding this comment

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

잠재적인 NullPointerException: 'application.id'에 대한 Null 검사 필요

application.id!!를 사용하고 있습니다. application.idnull일 경우 NullPointerException이 발생할 수 있습니다. application.id의 Null 여부를 확인하고 적절한 예외 처리를 추가하는 것이 좋습니다.

제안된 수정 사항:

-deleteApplicationPort.deleteByIdAndApplicationKind(application.id!!, applicationKind)
+application.id?.let {
+    deleteApplicationPort.deleteByIdAndApplicationKind(it, applicationKind)
+} ?: throw ApplicationIdNotFoundException()
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deleteApplicationPort.deleteByIdAndApplicationKind(application.id!!, applicationKind)
application.id?.let {
deleteApplicationPort.deleteByIdAndApplicationKind(it, applicationKind)
} ?: throw ApplicationIdNotFoundException()

Comment on lines +97 to +98
application.start,
application.end!!,
Copy link

Choose a reason for hiding this comment

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

잠재적인 NullPointerException: 'application.end'에 대한 Null 검사 필요

application.end!!를 사용하고 있습니다. application.endnull일 경우 NullPointerException이 발생할 수 있습니다. application.end의 Null 여부를 확인하고 적절한 예외 처리를 추가하는 것이 좋습니다.

제안된 수정 사항:

-return attendanceService.updateAttendanceToApplication(
+return if (application.end != null) {
+    attendanceService.updateAttendanceToApplication(
         application.start,
-        application.end!!,
+        application.end,
         application.applicationType,
         attendanceId!!
     )
+} else {
+    throw ApplicationEndNotFoundException()
+}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
application.start,
application.end!!,
return if (application.end != null) {
attendanceService.updateAttendanceToApplication(
application.start,
application.end,
application.applicationType,
attendanceId!!
)
} else {
throw ApplicationEndNotFoundException()
}

Comment on lines +72 to +74
val user = queryUserPort.findByXquareId(userId) ?: throw ApplicationNotFoundException
val isSubscribed =
queryTopicSubscriptionPort.queryTopicSubscriptionByDeviceToken(user.deviceToken!!).isSubscribed
Copy link

Choose a reason for hiding this comment

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

잠재적인 NullPointerException: 'user.deviceToken'에 대한 Null 검사 필요

user.deviceToken!!을 사용하고 있습니다. user.deviceTokennull일 경우 NullPointerException이 발생할 수 있습니다. user.deviceToken의 Null 여부를 확인하거나 안전한 호출 연산자(?.)를 사용하는 것이 좋습니다.

제안된 수정 사항:

 val user = queryUserPort.findByXquareId(userId) ?: throw ApplicationNotFoundException
 val isSubscribed =
-    queryTopicSubscriptionPort.queryTopicSubscriptionByDeviceToken(user.deviceToken!!).isSubscribed
+    user.deviceToken?.let {
+        queryTopicSubscriptionPort.queryTopicSubscriptionByDeviceToken(it).isSubscribed
+    } ?: false
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
val user = queryUserPort.findByXquareId(userId) ?: throw ApplicationNotFoundException
val isSubscribed =
queryTopicSubscriptionPort.queryTopicSubscriptionByDeviceToken(user.deviceToken!!).isSubscribed
val user = queryUserPort.findByXquareId(userId) ?: throw ApplicationNotFoundException
val isSubscribed =
user.deviceToken?.let {
queryTopicSubscriptionPort.queryTopicSubscriptionByDeviceToken(it).isSubscribed
} ?: false

Comment on lines +115 to +117
attendanceService.translateApplication(application.start, application.end!!, application.applicationType)
} else {
attendanceService.translateApplication(application.start, null, ApplicationType.TIME)
Copy link

Choose a reason for hiding this comment

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

잠재적인 NullPointerException: 'application.end'에 대한 Null 검사 필요

applicationKindAPPLICATION인 경우 application.end!!를 사용하고 있습니다. application.endnull일 수 있으므로 NullPointerException이 발생할 수 있습니다. application.end의 Null 여부를 확인하고 적절한 예외 처리를 추가하는 것이 좋습니다.

제안된 수정 사항:

 val (start, end) = if (applicationKind == ApplicationKind.APPLICATION) {
-    attendanceService.translateApplication(application.start, application.end!!, application.applicationType)
+    if (application.end != null) {
+        attendanceService.translateApplication(application.start, application.end, application.applicationType)
+    } else {
+        throw ApplicationEndNotFoundException()
+    }
 } else {
     attendanceService.translateApplication(application.start, null, ApplicationType.TIME)
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
attendanceService.translateApplication(application.start, application.end!!, application.applicationType)
} else {
attendanceService.translateApplication(application.start, null, ApplicationType.TIME)
val (start, end) = if (applicationKind == ApplicationKind.APPLICATION) {
if (application.end != null) {
attendanceService.translateApplication(application.start, application.end, application.applicationType)
} else {
throw ApplicationEndNotFoundException()
}
} else {
attendanceService.translateApplication(application.start, null, ApplicationType.TIME)
}

Comment on lines +95 to +100
val attendanceId = queryAttendancePort.findByUserId(application.userId)
return attendanceService.updateAttendanceToApplication(
application.start,
application.end!!,
application.applicationType,
attendanceId!!
Copy link

Choose a reason for hiding this comment

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

잠재적인 NullPointerException: 'attendanceId'에 대한 Null 검사 필요

attendanceId!!를 사용하고 있습니다. attendanceIdnull일 경우 NullPointerException이 발생할 수 있습니다. attendanceId의 Null 여부를 확인하고 적절한 예외 처리를 추가하는 것이 좋습니다.

제안된 수정 사항:

 val attendanceId = queryAttendancePort.findByUserId(application.userId)
-return attendanceService.updateAttendanceToApplication(
+return if (attendanceId != null) {
+    attendanceService.updateAttendanceToApplication(
         application.start,
         application.end!!,
         application.applicationType,
-        attendanceId!!
+        attendanceId
     )
+} else {
+    throw AttendanceNotFoundException()
+}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
val attendanceId = queryAttendancePort.findByUserId(application.userId)
return attendanceService.updateAttendanceToApplication(
application.start,
application.end!!,
application.applicationType,
attendanceId!!
val attendanceId = queryAttendancePort.findByUserId(application.userId)
return if (attendanceId != null) {
attendanceService.updateAttendanceToApplication(
application.start,
application.end!!,
application.applicationType,
attendanceId
)
} else {
throw AttendanceNotFoundException()
}

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.

2 participants