Skip to content

Conversation

@ljdongz
Copy link
Collaborator

@ljdongz ljdongz commented Apr 30, 2025

#️⃣ 연관된 이슈

📝 작업 내용

  • Repository 메서드 명 수정
  • Firebase Path 관리
  • FolderDTO init 제거 및 WriteFolder Entity 모델 추가
  • Repository 메서드의 파라미터로 ID 전달
  • ViewModel 일부 수정

@ljdongz ljdongz requested a review from f-lab-barry April 30, 2025 06:10
@ljdongz ljdongz self-assigned this Apr 30, 2025
@ljdongz ljdongz linked an issue Apr 30, 2025 that may be closed by this pull request
@ljdongz ljdongz changed the base branch from develop to feature/#16 April 30, 2025 06:11
@sonarqubecloud
Copy link

Comment on lines +14 to 19
@MainActor
func send(_ action: Action)

@MainActor
func reduce(state: inout State, action: Action) -> Effect<Action>
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

View로부터 액션을 전달받는 send(_:) 메서드와 기존 상태를 변경하고 새로운 이펙트를 반환하는 reduce(state:action:) 메서드를 메인 액터(메인 쓰레드)에서 안전하게 동작하도록 수정했습니다.

Comment on lines +10 to 11
@MainActor @Observable
final class MainViewModel: Reducer {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

화면에서 입력받은 액션을 처리해서 화면의 상태를 업데이트 하는 역할을 담당하는 ViewModel이 메인 액터(메인 쓰레드)에서 안전하게 동작되도록 수정했습니다.

Comment on lines +56 to +59
Task.detached { [weak self] in
let newAction = await action()
await self?.send(newAction)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

사이드 이펙트(비동기 처리)가 메인 액터의 격리에서 벗어난 상태에서 처리되도록 수정했습니다.


import Foundation

enum FirebasePath {
Copy link

@f-lab-barry f-lab-barry May 6, 2025

Choose a reason for hiding this comment

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

xxAPI 로 네이밍해도 좋을 것 같아요
xxEndpoint


enum FirebasePath {
case links(userID: String)
case folders(userID: String)

Choose a reason for hiding this comment

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

case folders(userID: String)
case folder(userID: String, folderID: String)

/// 1. Folder 문서 참조 생성
// TODO: 후에 testUser를 실제 로그인 된 유저로 변경 예정
let folderDocRef = db.collection("users/testUser/folders").document()
let path = FirebasePath.folders(userID: "testUser").path

Choose a reason for hiding this comment

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

케이스가 다양하기 때문에 네이밍을 좀 더 구체적으로 하면 좋을 것 같아요

Copy link

@f-lab-barry f-lab-barry left a comment

Choose a reason for hiding this comment

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

Endpoint 케이스 정리만 되면 좋을 것 같아요~

Base automatically changed from feature/#16 to develop May 6, 2025 16:47
@ljdongz ljdongz merged commit c01f20d into develop May 6, 2025
2 checks passed
@ljdongz ljdongz deleted the refactor/#20 branch May 6, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Repository 및 ViewModel 코드 리팩토링

3 participants