Skip to content

[#85] PushNotification 구조체를 레이어에 맞게 개선한다#151

Merged
opficdev merged 4 commits intodevelopfrom
refactor/#85-PushNotification
Feb 27, 2026
Merged

[#85] PushNotification 구조체를 레이어에 맞게 개선한다#151
opficdev merged 4 commits intodevelopfrom
refactor/#85-PushNotification

Conversation

@opficdev
Copy link
Owner

@opficdev opficdev self-assigned this Feb 27, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 푸시 알림 관련 데이터 모델을 계층형 아키텍처에 맞게 재구성하는 데 중점을 둡니다. 데이터 전송 객체(DTO), 도메인 엔티티, 그리고 프레젠테이션 모델 간의 명확한 분리를 통해 코드의 응집도를 높이고 유지보수성을 개선했습니다. 이 변경으로 각 계층의 역할이 더욱 명확해지고, 데이터 흐름이 구조화되었습니다.

Highlights

  • 레이어 분리: PushNotification 구조체를 Domain 레이어로 이동하고 Identifiable 프로토콜 준수를 제거하여 도메인 엔티티의 순수성을 확보했습니다.
  • 매핑 로직 중앙화: 데이터 전송 객체(DTO)와 도메인 엔티티 간의 매핑 로직을 PushNotificationMapping.swift 파일에 중앙화하여 데이터 변환을 일관성 있게 관리합니다.
  • DTO 구조 개선: PushNotificationCursorResponse를 PushNotificationCursorDTO로 대체하고, PushNotificationService 및 PushNotificationPageResponse에서 이를 사용하도록 업데이트하여 DTO 계층을 명확히 했습니다.
  • 프레젠테이션 모델 도입: Presentation 레이어에 PushNotificationItem 구조체를 도입하여 UI 관련 로직(예: Identifiable 준수)을 분리하고, 뷰 모델과 뷰가 이 모델을 사용하도록 업데이트했습니다.
Changelog
  • DevLog/Data/Mapper/PushNotificationMapping.swift
    • PushNotificationResponse, PushNotificationCursorDTO, PushNotificationPageResponse를 도메인 엔티티로 변환하는 매핑 확장 기능을 추가했습니다.
  • DevLog/Data/Repository/PushNotificationRepositoryImpl.swift
    • requestNotifications 메서드에서 새로운 매핑 로직을 사용하여 코드를 간소화했습니다.
  • DevLog/Domain/Entity/PushNotification.swift
    • PushNotification 구조체를 Infra/DTO에서 Domain/Entity로 이동하고 Identifiable 프로토콜 준수를 제거했습니다.
  • DevLog/Infra/DTO/PushNotificationCursorDTO.swift
    • 푸시 알림 커서에 대한 새로운 DTO 구조체를 추가했습니다.
  • DevLog/Infra/DTO/PushNotificationCursorResponse.swift
    • 더 이상 사용되지 않는 PushNotificationCursorResponse 파일을 제거했습니다.
  • DevLog/Infra/DTO/PushNotificationPageResponse.swift
    • nextCursor 속성의 타입을 PushNotificationCursorDTO로 업데이트했습니다.
  • DevLog/Infra/Service/PushNotificationService.swift
    • requestNotifications 메서드의 cursor 매개변수 타입을 PushNotificationCursorDTO로 변경하고, 내부 로직을 새로운 DTO에 맞게 조정했습니다.
  • DevLog/Presentation/Structure/PushNotificationItem.swift
    • PushNotification 도메인 엔티티를 기반으로 하는 Identifiable 및 Hashable을 준수하는 프레젠테이션용 PushNotificationItem 구조체를 추가했습니다.
  • DevLog/Presentation/ViewModel/PushNotificationListViewModel.swift
    • 뷰 모델의 상태 및 액션에서 PushNotification 대신 PushNotificationItem을 사용하도록 업데이트하고, 데이터 매핑 로직을 추가했습니다.
  • DevLog/UI/PushNotification/PushNotificationListView.swift
    • UI 컴포넌트가 PushNotificationItem을 직접 사용하도록 변경하여 프레젠테이션 계층과의 일관성을 유지했습니다.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이번 PR은 PushNotification 관련 구조를 데이터, 도메인, 프레젠테이션 레이어에 맞게 개선하는 중요한 리팩토링을 포함하고 있습니다. DTO와 도메인 모델을 분리하고, 각 레이어 간의 매핑 로직을 Mapper로 추출하여 코드의 역할과 책임이 명확해졌습니다. 또한, 프레젠테이션 레이어를 위한 PushNotificationItem 모델을 도입하여 SwiftUI 뷰와의 결합도를 낮춘 점이 인상적입니다. 전반적으로 코드의 구조가 개선되어 유지보수성과 테스트 용이성이 크게 향상되었습니다. 한 가지 작은 개선점을 제안드렸으니 확인 부탁드립니다.

Comment on lines 19 to 47
private init(
id: String,
title: String,
body: String,
receivedAt: Date,
isRead: Bool,
todoID: String,
todoKind: TodoKind
) {
self.id = id
self.title = title
self.body = body
self.receivedAt = receivedAt
self.isRead = isRead
self.todoID = todoID
self.todoKind = todoKind
}

init(from notification: PushNotification) {
self.init(
id: notification.id,
title: notification.title,
body: notification.body,
receivedAt: notification.receivedAt,
isRead: notification.isRead,
todoID: notification.todoID,
todoKind: notification.todoKind
)
}

Choose a reason for hiding this comment

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

medium

하나의 public init에서만 사용되는 private init은 불필요하게 코드를 길게 만듭니다. init(from:) 이니셜라이저가 직접 프로퍼티를 설정하도록 수정하면 코드를 더 간결하고 명확하게 만들 수 있습니다.

    init(from notification: PushNotification) {
        self.id = notification.id
        self.title = notification.title
        self.body = notification.body
        self.receivedAt = notification.receivedAt
        self.isRead = notification.isRead
        self.todoID = notification.todoID
        self.todoKind = notification.todoKind
    }

Choose a reason for hiding this comment

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

private init을 제거하고 init(from notification: PushNotification) 내에서 직접 프로퍼티를 할당하도록 제안된 리팩토링이 이 섹션에 적용되었습니다.

@opficdev
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이 Pull Request는 PushNotification 구조체를 레이어에 맞게 개선하는 변경사항을 포함하고 있습니다. 데이터 전송 객체(DTO)와 도메인 엔티티, 그리고 프레젠테이션 아이템 간의 역할을 명확히 분리하여 코드의 가독성과 유지보수성을 크게 향상시켰습니다. 특히, PushNotificationMapping.swift 파일을 통해 매핑 로직을 중앙화하고, PushNotificationItem을 도입하여 뷰 모델과 뷰가 도메인 엔티티 대신 프레젠테이션 전용 모델을 사용하도록 변경한 점은 아키텍처적으로 매우 긍정적인 개선입니다. 전반적으로 변경사항은 깔끔하며, 특별히 수정이 필요한 문제점이나 개선할 기회는 발견되지 않았습니다.

@opficdev opficdev merged commit a6f9a79 into develop Feb 27, 2026
1 check passed
@opficdev opficdev deleted the refactor/#85-PushNotification branch February 27, 2026 02:09
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.

PushNotification 구조체를 레이어에 맞게 개선한다

1 participant