Conversation
User model은 data class 로, 각 유즈케이스 목록은 다음과 같다. - CreateUserUseCase - DeleteUserUseCase - GetUserUseCase - UpdateUserUseCase 해당 유즈케이스들은 suspend로 중단 함수를 통해 비동기 처리 가능하게 선언했으며, invoke 함수를 통해 클래스 인스턴스를 함수호출처럼 사용할 수 있게 만들었다. 또한, 각 유즈케이스의 결과를 알아야하는 것들은 Result<Unit> 을 반환하도록 만들었다.
DeleteUserUseCase: user 판별을 id:Long으로 변경 GetUserUseCase: 리턴 타입을 Result<User?> 로 변경하여 성공, 실패 여부를 추가했다. 성공 시 필요한 user 정보와 성공 상태를 같이 주고, 실패랄 경우 User? 에의해 null 이 들어오면서 실패 처리가 되는 것이다. Result<T> 타입을 모두 반환하게 하여 명확한 에러 핸들링, 미래 확장성 대비, 코드의 일관성을 추구했다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#⃣ 연관된 이슈
close #7
📝 작업 내용
📸 스크린샷 (선택)
💬 리뷰 요구사항(선택)
suspend 함수 사용법에 대한 의견이나 더 좋은 점이 있으면 의논해봤으면 좋겠어요!