Skip to content

Conversation

@rootTiket
Copy link
Member

1. 무슨 이유로 코드를 변경했나요?


portfolio 도메인 마이그레이션을 진행했습니다

close #75

2. 어떤 위험이나 장애를 발견했나요?


양방향 매핑이 있긴한데 일단 기존 로직 그대로 마이그레이션 진행했습니다

3. 관련 스크린샷을 첨부해주세요.


image

4. 완료 사항


  • 도메인 마이그레이션
  • 비즈니스 로직 테스트

5. 추가 사항

Copy link
Member

@yechan-kim yechan-kim left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 근표님!
코멘트 확인 부탁드릴게요~

Comment on lines 50 to 52
@OneToMany(mappedBy = "portfolio", fetch = FetchType.EAGER, orphanRemoval = true)
@JsonIgnore
val contributors: MutableList<Contributor> = mutableListOf()
Copy link
Member

Choose a reason for hiding this comment

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

ListMutableList의 차이를 알 수 있을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

가변/불변 차이로 알고있습니다
Contributors는 그 list 원소가 변경될 수 있으므로 MutableList를 사용했습니다

Copy link
Member Author

Choose a reason for hiding this comment

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

ArrayList로 수정했습니다 ~

enum class ProjectScope(val projectScope: String) {
TOY("Toy"),
FINAL("Final")
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

개행 준수 부탁드려요~

Copy link
Member Author

Choose a reason for hiding this comment

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

수정했습니다

Comment on lines 18 to 28
return if (generation == null) {
listOf(
getPortfoliosByScope(ProjectScope.FINAL),
getPortfoliosByScope(ProjectScope.TOY)
)
} else {
listOf(
getPortfoliosByGenerationAndScope(generation.toLong(), ProjectScope.FINAL),
getPortfoliosByGenerationAndScope(generation.toLong(), ProjectScope.TOY)
)
}
Copy link
Member

Choose a reason for hiding this comment

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

early return 패턴을 사용하면, 코드의 가독성이 더 좋아질 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

기존 코드 흐름을 준수하기 위해 별도 수정을 진행하지 않았습니다.
변경하는게 더 나아보이시나요?

Comment on lines 39 to 52
private fun getPortfoliosByScope(scope: ProjectScope): List<PortfoliosResponse> {
return portfolioRepository.findAllByScopeOrderByGenerationDesc(scope)
.map { PortfoliosResponse.from(it) }
.toList()
}

private fun getPortfoliosByGenerationAndScope(
generation: Long,
scope: ProjectScope
): List<PortfoliosResponse> {
return portfolioRepository.findAllByGenerationAndScope(generation, scope)
.map { PortfoliosResponse.from(it) }
.toList()
}
Copy link
Member

Choose a reason for hiding this comment

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

위의 코드를 보아하니, all method에서만 사용하는 코드인 것 같네요.
두 method의 차이는 generation의 유무에 따라 사용되는 쿼리 차이인 것 같은데,
두 method를 통합하고, 분기를 통합된 메서드 내부에서 진행하는 건 어떤가요?
아래는 제가 제안한 내용에 대한 대략적인 코드입니다!

private fun getPortfolios(
    generation: Long?,
    scope: ProjectScope
): List<PortfoliosResponse> {

    val list = if (generation == null) {
        portfolioRepository.findAllByScope(scope)
    } else {
        portfolioRepository.findAllByGenerationAndScope(generation, scope)
    }

    return list
        .map { PortfoliosResponse.from(it) }
        .toList();
}

Copy link
Member Author

Choose a reason for hiding this comment

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

여기도 마찬가지로 기존 비즈니스 로직을 그대로 변경하자는 요구사항이 있어 별도 흐름 수정을 진행하지 않았습니다
변경하는게 더 좋아보이시나요? 의견 부탁드립니다

Copy link
Member

@yechan-kim yechan-kim Dec 22, 2025

Choose a reason for hiding this comment

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

개인적으로는 기존의 흐름을 많이 해치지 않는 개선은 괜찮다고 생각합니다!
@jwnnoh 님의 의견이 궁금해요!

Copy link
Member

Choose a reason for hiding this comment

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

두 분 다 충분히 고민해주신 것 같아서 고민을 하고 있었는데 제가 좀 늦게 왔네요 ㅎㅎ..
기존 흐름이 크게 변경되지는 않는 변경점인 것 같아서 변경하는 것도 좋아보입니다!

고생하셨어요 ❤️

@rootTiket rootTiket requested a review from yechan-kim December 22, 2025 08:43
Copy link
Member

@yechan-kim yechan-kim left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다~ 😊

@rootTiket rootTiket merged commit daa2493 into main Dec 22, 2025
1 check passed
@rootTiket rootTiket deleted the refactor/#75 branch December 22, 2025 11:33
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] portfolio 도메인 리펙토링

4 participants