Skip to content
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

๐Ÿš€ 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ(๋„๋ฉ”์ธ ๋ชจ๋ธ) #627

Open
wants to merge 23 commits into
base: mingulee-devel
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f89ccf9
refactor: 1๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜ - ๋ถˆํ•„์š” setDeleted ์‚ฌ์šฉ ์ œ๊ฑฐ
mingulee-devel Oct 28, 2024
372331e
refactor: 1๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜ - DeleteHistory ์ƒ์„ฑ์ž๊ฐ€ ์•„๋‹Œ ์ •์  ํŒฉํ† ๋ฆฌ ๋ฉ”์„œ๋“œ๋กœ ์ƒ์„ฑํ•˜๋„๋ก ์ˆ˜์ •
mingulee-devel Oct 28, 2024
8928f60
chore: ๋ถˆํ•„์š” ์ฝ”๋“œ ์‚ญ์ œ
mingulee-devel Oct 28, 2024
d965af3
docs: ๋ถˆํ•„์š” TODO ์‚ญ์ œ
mingulee-devel Oct 28, 2024
a22f18e
refactor: 1๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜ - Answers ์ผ๊ธ‰์ปฌ๋ ‰์…˜ ๋ถ„๋ฆฌ, ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ˆ˜์ •
mingulee-devel Oct 28, 2024
e9340bd
refactor: QuestionBody ๋ถ„๋ฆฌ
mingulee-devel Oct 30, 2024
1ec08ae
refactor: Deleted ๋ถ„๋ฆฌ
mingulee-devel Oct 30, 2024
f320b7b
docs: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ TODO ์ž‘์„ฑ
mingulee-devel Oct 30, 2024
e379e60
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ์ƒํƒœ ๋„๋ฉ”์ธ ๊ตฌํ˜„
mingulee-devel Oct 30, 2024
8311e79
test: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ๋„๋ฉ”์ธ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
mingulee-devel Oct 30, 2024
c3837de
test: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ๋„๋ฉ”์ธ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
mingulee-devel Oct 30, 2024
6a0964e
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ๋„๋ฉ”์ธ ๊ตฌํ˜„
mingulee-devel Oct 30, 2024
bcae477
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ํ…Œ์ŠคํŠธ์ฝ”๋“œ ๋ฐ ๋„๋ฉ”์ธ ๊ตฌํ˜„
mingulee-devel Oct 30, 2024
dcea385
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ์œ ๋ฃŒ๊ฐ•์˜ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€
mingulee-devel Oct 30, 2024
3423226
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ์ฝ”์Šค์— ๊ฐ•์˜ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€
mingulee-devel Oct 31, 2024
2a43351
feat: 2๋‹จ๊ณ„ - Course ๊ธฐ์ˆ˜ ์ถ”๊ฐ€
mingulee-devel Oct 31, 2024
82675be
feat: 2๋‹จ๊ณ„ - SessionStrategy ์ˆ˜์ •, PaidSession List<Payment> ์ถ”๊ฐ€
mingulee-devel Oct 31, 2024
f787e17
feat: 2๋‹จ๊ณ„ - Payments ์ผ๊ธ‰์ปฌ๋ ‰์…˜ ๋ถ„๋ฆฌ
mingulee-devel Oct 31, 2024
26e958f
feat: 2๋‹จ๊ณ„ - Sessions ์ผ๊ธ‰์ปฌ๋ ‰์…˜ ๋ถ„๋ฆฌ
mingulee-devel Oct 31, 2024
cf83180
feat: 2๋‹จ๊ณ„ - SessionDate ๋ถ„๋ฆฌ
mingulee-devel Oct 31, 2024
6355517
feat: 2๋‹จ๊ณ„ - session ํŒจํ‚ค์ง€ ์ถ”๊ฐ€, Payments payments ํŒจํ‚ค์ง€๋กœ ํŒŒ์ผ ์ด๋™
mingulee-devel Oct 31, 2024
786f774
feat: 2๋‹จ๊ณ„ - ImageExtension(Enum), ImageSize, ImageDimensions ๋ถ„๋ฆฌ
mingulee-devel Oct 31, 2024
950b4a8
refeactor: 2๋‹จ๊ณ„ ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜ - ์œ ํšจํ•œ ํ™•์žฅ์ž ์ƒ์ˆ˜๋กœ ๋ถ„๋ฆฌ
mingulee-devel Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: 2๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ•์˜ ํ…Œ์ŠคํŠธ์ฝ”๋“œ ๋ฐ ๋„๋ฉ”์ธ ๊ตฌํ˜„
mingulee-devel committed Oct 30, 2024
commit bcae477be8b41f8a170c670d874f0e59262f3367
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ Answer
- List<Session>


- [ ] Session
- [x] Session
- ์‹œ์ž‘์ผ, ์ข…๋ฃŒ์ผ
- ์ปค๋ฒ„ ์ด๋ฏธ์ง€ ์ •๋ณด
- ๊ฐ•์˜ ์œ ํ˜•(๋ฌด๋ฃŒ/์œ ๋ฃŒ)
@@ -77,10 +77,10 @@ Answer
- width >= 300, height >= 200 / width * 2 = height * 3


- [ ] ๋ฌด๋ฃŒ ๊ฐ•์˜
- [x] ๋ฌด๋ฃŒ ๊ฐ•์˜
- ์ตœ๋Œ€ ์ˆ˜๊ฐ• ์ธ์› ์ œํ•œ ์—†์Œ

- [ ] ์œ ๋ฃŒ ๊ฐ•์˜
- [x] ์œ ๋ฃŒ ๊ฐ•์˜
- ๊ฐ•์˜ ์ตœ๋Œ€ ์ˆ˜๊ฐ•์ธ์›
- ๊ฐ•์˜ ์ตœ๋Œ€ ์ˆ˜๊ฐ•์ธ์› ์ดˆ๊ณผ ๋ถˆ๊ฐ€
- ์ˆ˜๊ฐ•๋ฃŒ
8 changes: 8 additions & 0 deletions src/main/java/nextstep/courses/domain/FreeSession.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package nextstep.courses.domain;

public class FreeSession implements SessionStrategy {
@Override
public boolean canEnroll() {
return true;
}
}
29 changes: 29 additions & 0 deletions src/main/java/nextstep/courses/domain/PaidSession.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package nextstep.courses.domain;

public class PaidSession implements SessionStrategy {

private int maxEnrollmentCount;
private int currentEnrollmentCount;
private int tuitionFee;

private int paymentAmount; //todo

public PaidSession(int maxEnrollmentCount, int currentEnrollmentCount, int tuitionFee, int paymentAmount){
this.maxEnrollmentCount = maxEnrollmentCount;
this.currentEnrollmentCount = currentEnrollmentCount;
this.tuitionFee = tuitionFee;
this.paymentAmount = paymentAmount;
}

private boolean isFull() {
return maxEnrollmentCount <= currentEnrollmentCount;
}
private boolean isTuitionPaid() {
return tuitionFee == paymentAmount;
}

@Override
public boolean canEnroll() {
return !isFull() && isTuitionPaid(); //todo
}
}
34 changes: 25 additions & 9 deletions src/main/java/nextstep/courses/domain/Session.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
package nextstep.courses.domain;

import java.time.LocalDate;

public class Session {

public boolean isValidCoverImage() {
return false;
private LocalDate startDate;
private LocalDate endDate;
private SessionCoverImage sessionCoverImage;
private SessionStatus sessionStatus;
private SessionStrategy sessionTypeStrategy;

public Session(SessionCoverImage sessionCoverImage, SessionStatus sessionStatus, SessionStrategy sessionTypeStrategy) {
this(null, null, sessionCoverImage, sessionStatus, sessionTypeStrategy);
}
public boolean canEnroll() {
return false;

public Session(LocalDate startDate, LocalDate endDate, SessionCoverImage sessionCoverImage, SessionStatus sessionStatus, SessionStrategy sessionTypeStrategy) {
this.startDate = startDate;
this.endDate = endDate;
this.sessionCoverImage = sessionCoverImage;
this.sessionStatus = sessionStatus;
this.sessionTypeStrategy = sessionTypeStrategy;
}
private boolean isFull() {
return false;

public boolean isValidCoverImage() {
return sessionCoverImage.isValidCoverImage();
}
private boolean isTuitionPaid() {
return false;

public boolean canEnroll() {
return sessionTypeStrategy.canEnroll() && isRecruiting();
}

private boolean isRecruiting() {
return false;
return sessionStatus.isRecruiting();
}
}
6 changes: 6 additions & 0 deletions src/main/java/nextstep/courses/domain/SessionStrategy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package nextstep.courses.domain;

@FunctionalInterface
public interface SessionStrategy {
boolean canEnroll();
}
26 changes: 14 additions & 12 deletions src/test/java/nextstep/courses/infrastructure/SessionTest.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
package nextstep.courses.infrastructure;

import nextstep.courses.domain.Session;
import org.junit.jupiter.api.BeforeEach;
import nextstep.courses.domain.*;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class SessionTest {

private Session session;

@BeforeEach
void setUp() {
session = new Session();
}

@Test
void ์ปค๋ฒ„_์ด๋ฏธ์ง€_ํ™•์ธ() {
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, () -> true);
assertTrue(session.isValidCoverImage());
}

@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ__์ธ์›์ดˆ๊ณผ_ํ™•์ธ() {
// session.setEnrollmentCount(0);
// assertTrue(session.isFull());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, new PaidSession(3, 2, 20000, 20000));
assertTrue(session.canEnroll());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, new PaidSession(2, 2, 20000, 20000));
assertFalse(session.canEnroll());
}

@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ__๊ฐ•์˜_์ˆ˜๊ฐ•๋ฃŒ_ํ™•์ธ() {
// session.setTuitionFee(20000);
// assertTrue(session.isTuitionPaid(20000)); //์ˆ˜๊ฐ•์ƒ์ด ๊ฒฐ์ œํ•œ ๊ธˆ์•ก
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, new PaidSession(3, 2, 20000, 20000));
assertTrue(session.canEnroll());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, new PaidSession(3, 2, 20000, 15000));
assertFalse(session.canEnroll());
}

@Test
void ์ˆ˜๊ฐ•์‹ ์ฒญ_๊ฐ€๋Šฅ์—ฌ๋ถ€_ํ™•์ธ__๊ฐ•์˜_์ƒํƒœ_๋ชจ์ง‘์ค‘() {
// assertTrue(session.isRecruiting());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.RECRUITING, () -> true);
assertTrue(session.canEnroll());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.CLOSED, new FreeSession());
assertFalse(session.canEnroll());
session = new Session(new SessionCoverImage("gif", 300, 200), SessionStatus.CLOSED, new PaidSession(3, 2, 20000, 20000));
assertFalse(session.canEnroll());
}

}