-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: portfolio 도메인 마이그레이션 #76
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
Changes from 5 commits
92ed196
f3c8f41
9b5f55f
ce47b3e
38e407a
6741ab9
a173b51
165c2a3
3c648ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package land.leets.domain.portfolio.domain | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnore | ||
| import jakarta.persistence.* | ||
| import land.leets.domain.contributor.domain.Contributor | ||
| import land.leets.domain.portfolio.type.ProjectScope | ||
| import land.leets.domain.portfolio.type.ProjectType | ||
| import land.leets.domain.shared.BaseTimeEntity | ||
| import java.time.LocalDate | ||
|
|
||
| @Entity(name = "portfolios") | ||
| class Portfolio( | ||
| @Column(nullable = false) | ||
| val generation: Long, | ||
|
|
||
| @Column(nullable = false) | ||
| val name: String, | ||
|
|
||
| @Column(nullable = false) | ||
| val summary: String, | ||
|
|
||
| @Column(columnDefinition = "text", nullable = false) | ||
| val description: String, | ||
|
|
||
| @Column(nullable = false) | ||
| val type: ProjectType, | ||
|
|
||
| @Column(nullable = false) | ||
| val scope: ProjectScope, | ||
|
|
||
| @Column(nullable = false) | ||
| val startDate: LocalDate, | ||
|
|
||
| @Column(nullable = false) | ||
| val endDate: LocalDate, | ||
|
|
||
| @Column(nullable = false) | ||
| val serviceUrl: String, | ||
|
|
||
| @Column(nullable = false) | ||
| val logoImgName: String, | ||
|
|
||
| @Column(nullable = false) | ||
| val mainImgName: String, | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| val portfolioId: Long = 0L, | ||
|
|
||
| @OneToMany(mappedBy = "portfolio", fetch = FetchType.EAGER, orphanRemoval = true) | ||
| @JsonIgnore | ||
| val contributors: MutableList<Contributor> = mutableListOf() | ||
| ) : BaseTimeEntity() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package land.leets.domain.portfolio.domain.repository | ||
|
|
||
| import land.leets.domain.portfolio.domain.Portfolio | ||
| import land.leets.domain.portfolio.type.ProjectScope | ||
| import org.springframework.data.jpa.repository.JpaRepository | ||
|
|
||
| interface PortfolioRepository : JpaRepository<Portfolio, Long> { | ||
| fun findAllByGenerationAndScope(generation: Long, scope: ProjectScope): List<Portfolio> | ||
|
|
||
| fun findAllByScopeOrderByGenerationDesc(scope: ProjectScope): List<Portfolio> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package land.leets.domain.portfolio.exception | ||
|
|
||
| import land.leets.global.error.ErrorCode | ||
| import land.leets.global.error.exception.ServiceException | ||
|
|
||
| class PortfolioNotFoundException : ServiceException(ErrorCode.PORTFOLIO_NOT_FOUND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List와MutableList의 차이를 알 수 있을까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
가변/불변 차이로 알고있습니다
Contributors는 그 list 원소가 변경될 수 있으므로 MutableList를 사용했습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayList로 수정했습니다 ~