-
Notifications
You must be signed in to change notification settings - Fork 248
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
π 4λ¨κ³ - μκ°μ μ²(μꡬμ¬ν λ³κ²½) #387
base: kyunghyun-park
Are you sure you want to change the base?
Changes from all commits
cd795cf
8396e29
d8942f1
3bc847f
5750dc2
8e77d9d
e7af105
0c96d79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# π 4λ¨κ³ - μκ°μ μ²(μꡬμ¬ν λ³κ²½) | ||
|
||
## ν΅μ¬ νμ΅ λͺ©ν | ||
|
||
- DB ν μ΄λΈμ΄ λ³κ²½λ λλ μ€νΈλκΈλ¬ ν¨ν΄μ μ μ©ν΄ μ μ§μ μΈ λ¦¬ν©ν°λ§μ μ°μ΅νλ€. | ||
- [μ€νΈλκΈλ¬(κ΅μ΄μ) ν¨ν΄ - λ§ν΄ νμΈλ¬](https://martinfowler.com/bliki/StranglerFigApplication.html) | ||
- [μ€νΈλκΈλ¬ 무νκ³Ό ν¨ν΄](https://docs.microsoft.com/ko-kr/azure/architecture/patterns/strangler-fig) | ||
|
||
<br> | ||
|
||
## λ³κ²½λ κΈ°λ₯ μꡬμ¬ν | ||
### **κ°μ μκ°μ μ²μ κ°μ μνκ° λͺ¨μ§μ€μΌ λλ§ κ°λ₯νλ€.** | ||
- [X] κ°μκ° μ§ν μ€μΈ μνμμλ μκ°μ μ²μ΄ κ°λ₯ν΄μΌ νλ€. | ||
- κ°μ μ§ν μν(μ€λΉμ€, μ§νμ€, μ’ λ£)μ λͺ¨μ§ μν(λΉλͺ¨μ§μ€, λͺ¨μ§μ€)λ‘ μν κ°μ λΆλ¦¬ν΄μΌ νλ€. | ||
|
||
### **κ°μλ κ°μ μ»€λ² μ΄λ―Έμ§ μ 보λ₯Ό κ°μ§λ€.** | ||
- [X] κ°μλ **νλ μ΄μ**μ μ»€λ² μ΄λ―Έμ§λ₯Ό κ°μ§ μ μλ€. | ||
|
||
### κ°μ¬κ° μΉμΈνμ§ μμλ μκ° μ μ²νλ λͺ¨λ μ¬λμ΄ μκ° κ°λ₯νλ€. | ||
- [ ] μ°μνν ν¬μ½μ€(무λ£), μ°μνν ν¬μΊ ν Pro(μ λ£)μ κ°μ΄ μ λ°λ μΈμλ§ μκ° κ°λ₯ν΄μΌ νλ€. | ||
- [ ] κ°μ¬λ μκ°μ μ²ν μ¬λ μ€ μ λ°λ μΈμμ λν΄μλ§ μκ° μΉμΈμ΄ κ°λ₯ν΄μΌ νλ€. | ||
- [ ] κ°μ¬λ μκ°μ μ²ν μ¬λ μ€ μ λ°λμ§ μμ μ¬λμ μκ°μ μ·¨μν μ μμ΄μΌ νλ€. | ||
|
||
<br> | ||
|
||
## νλ‘κ·Έλλ° μꡬμ¬ν | ||
- 리ν©ν°λ§ν λ μ»΄νμΌ μλ¬μ κΈ°μ‘΄μ λ¨μ ν μ€νΈμ μ€ν¨λ₯Ό μ΅μννλ©΄μ μ μ§μ μΈ λ¦¬ν©ν°λ§μ΄ κ°λ₯νλλ‘ νλ€. | ||
- DB ν μ΄λΈμ λ°μ΄ν°κ° μ‘΄μ¬νλ€λ κ°μ νμ 리ν©ν°λ§ν΄μΌ νλ€. | ||
- μ¦, κΈ°μ‘΄μ μμΈ λ°μ΄ν°λ₯Ό μ κ±°νμ§ μμ μνλ‘ λ¦¬ν©ν°λ§ ν΄μΌ νλ€. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package nextstep.courses.domain; | ||
|
||
import nextstep.courses.exception.EmptyCoverImageException; | ||
|
||
import java.util.List; | ||
|
||
public class CoverImages { | ||
|
||
private List<CoverImage> images; | ||
|
||
public CoverImages(List<CoverImage> images) { | ||
validateIsNull(images); | ||
this.images = images; | ||
} | ||
|
||
private void validateIsNull(List<CoverImage> images) { | ||
if (images == null || images.isEmpty()) { | ||
throw new EmptyCoverImageException(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package nextstep.courses.domain; | ||
|
||
import nextstep.courses.exception.InvalidRecruitmentStatusException; | ||
|
||
import java.util.Arrays; | ||
|
||
public enum RecruitmentStatus { | ||
NOT_RECRUITMENT, | ||
RECRUITING; | ||
|
||
private static final RecruitmentStatus[] VALUES = values(); | ||
|
||
public static RecruitmentStatus findByName(String name) { | ||
return Arrays.stream(VALUES) | ||
.filter(status -> status.name().equalsIgnoreCase(name)) | ||
.findFirst() | ||
.orElseThrow(() -> new InvalidRecruitmentStatusException(name)); | ||
} | ||
|
||
public RecruitmentStatus ofRecruiting() { | ||
return RECRUITING; | ||
} | ||
|
||
public boolean isRecruiting() { | ||
return this == RECRUITING; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package nextstep.courses.domain; | ||
|
||
import java.time.LocalDate; | ||
|
||
public enum SessionStatus { | ||
PREPARING, | ||
IN_PROGRESS, | ||
COMPLETED; | ||
|
||
public static SessionStatus of(LocalDate now, LocalDate startDate, LocalDate endDate) { | ||
if (now.isBefore(startDate)) { | ||
return PREPARING; | ||
} | ||
|
||
if (now.isAfter(startDate) && now.isBefore(endDate)) { | ||
return IN_PROGRESS; | ||
} | ||
|
||
return COMPLETED; | ||
} | ||
|
||
public boolean isInProgress() { | ||
return this == IN_PROGRESS; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
package nextstep.courses.domain; | ||
|
||
import nextstep.courses.exception.InvalidSessionStatusException; | ||
import nextstep.courses.exception.NotOpenSessionException; | ||
|
||
import java.util.Arrays; | ||
import java.time.LocalDate; | ||
|
||
public enum Status { | ||
NOT_OPEN, | ||
OPEN, | ||
CLOSED; | ||
public class Status { | ||
|
||
private SessionStatus sessionStatus; | ||
private RecruitmentStatus recruitmentStatus; | ||
|
||
public Status ofOpen() { | ||
return OPEN; | ||
public Status(LocalDate now, LocalDate startDate, LocalDate endDate) { | ||
this(SessionStatus.of(now, startDate, endDate), RecruitmentStatus.NOT_RECRUITMENT); | ||
} | ||
|
||
public boolean isOpen() { | ||
return this == OPEN; | ||
public Status(LocalDate now, LocalDate startDate, LocalDate endDate, RecruitmentStatus recruitmentStatus) { | ||
this(SessionStatus.of(now, startDate, endDate), recruitmentStatus); | ||
} | ||
|
||
public static Status findByName(String name) { | ||
return Arrays.stream(values()) | ||
.filter(status -> status.name().equalsIgnoreCase(name)) | ||
.findFirst() | ||
.orElseThrow(() -> new InvalidSessionStatusException(name)); | ||
public Status(SessionStatus sessionStatus, RecruitmentStatus recruitmentStatus) { | ||
this.sessionStatus = sessionStatus; | ||
this.recruitmentStatus = recruitmentStatus; | ||
} | ||
|
||
public void validate() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (!sessionStatus.isInProgress() && !recruitmentStatus.isRecruiting()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
throw new NotOpenSessionException(); | ||
} | ||
} | ||
|
||
public void startRecruiting() { | ||
this.recruitmentStatus = recruitmentStatus.ofRecruiting(); | ||
} | ||
|
||
public String sessionStatus() { | ||
return this.sessionStatus.name(); | ||
} | ||
|
||
public String recruitmentStatus() { | ||
return this.recruitmentStatus.name(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nextstep.courses.exception; | ||
|
||
public class EmptyCoverImageException extends RuntimeException { | ||
|
||
public EmptyCoverImageException() { | ||
super("κ°μλ νλ μ΄μμ μ»€λ² μ΄λ―Έμ§λ₯Ό κ°μ ΈμΌ ν©λλ€."); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nextstep.courses.exception; | ||
|
||
public class InvalidRecruitmentStatusException extends RuntimeException { | ||
|
||
public InvalidRecruitmentStatusException(String code) { | ||
super("μ‘΄μ¬νμ§ μλ κ°μ λͺ¨μ§ μνμ λλ€." + code); | ||
} | ||
} |
This file was deleted.
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.
Status
κ° μ‘°νν΄μ¨ λ°μ΄ν°μ λ μ§λ₯Ό κΈ°μ€μΌλ‘ μ€μ λλλ°, μμλ‘ μνκ° λ³κ²½λλ©΄ κ°μ¬μκ² νΌλμ΄ λ°μν μ μμ κ²μΌλ‘ 보μ λλ€.Status
μ λ³κ²½μ λͺ μμ μΌλ‘ κ°μ¬κ° μ§ννλ€λ μ μ νμ ꡬνν΄λ³΄μλ©΄ μ’κ² μ΅λλ€.νμ μμλ λ μ§κ° κ²½κ³Όλλ©΄ λ°°μΉ λ±μ μ΄μ©ν΄μ μλμΌλ‘
Status
κ° λ³κ²½λλλ‘ κ΅¬ννμ€ μ μμν λ°, μ΄ κ²½μ° λ°μ΄ν°λ₯Ό μμ νμ€ κ² κ°μμ. κ°μ²΄λ₯Ό λ§λ€ λ μμλ‘ μνλ₯Ό λ§λλ κ²μ μ½λλ₯Ό μ΄ν΄νκ±°λ μ μ§λ³΄μνκΈ° μ΄λ ΅κ² λ§λ€ μ μμΌλ©°, λλ²κΉ κ³Όμ μμλ μ΄λ €μμ΄ λ°μν μ μμ΅λλ€.