-
Notifications
You must be signed in to change notification settings - Fork 247
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
3단계 - 수강신청(DB 적용) #642
base: lee-won-suk
Are you sure you want to change the base?
3단계 - 수강신청(DB 적용) #642
Changes from all commits
99ee29b
b3f2ee9
9b3eae7
cdd9531
aef0900
e006874
3665cb3
2396f22
e32989a
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,21 @@ | ||
# 학습 관리 시스템(Learning Management System) | ||
|
||
## step3 요구사항 | ||
|
||
1. [x] 앞단계에서 구현한 도메인 모델 DB와 매핑하고 데이터 저장 | ||
2. | ||
2. 테이블 설계하고 객체매핑 | ||
2. [x] Payments는 테이블 매핑 미고려 | ||
|
||
## 관련 클래스 | ||
|
||
1. DB 테이블 resources/schema.sql | ||
2. jdbcCourseRepository | ||
3. CourseRepositoryTest | ||
|
||
|
||
## 주요 피드백 | ||
1. 숫자로 순서를 써서 하는건 실수 및 어려운 문제가 있음 | ||
-> NamedParameterJdbcTemplate사용해보기 | ||
|
||
2. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nextstep.courses.domain; | ||
|
||
import java.util.List; | ||
|
||
public interface CourseSessionRepository { | ||
int save(Long courseId, List<Long> sessionIds); | ||
List<Long> findByCourseId(Long id); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package nextstep.courses.domain; | ||
|
||
import nextstep.courses.Exception.CustomException; | ||
import nextstep.courses.exception.CustomException; | ||
import nextstep.payments.domain.Payment; | ||
|
||
public class PricingType { | ||
|
||
private final int sessionAmount; | ||
private boolean isPremium; | ||
private final boolean isPremium; | ||
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. 지금은 두개의 타입만 존재하지만, 요구사항이 추가되어 다른 타입의 강의도 생성될 수 있지 않을까요? |
||
|
||
|
||
|
||
public PricingType(boolean isPremium, int sessionAmount) { | ||
validate(isPremium,sessionAmount); | ||
|
@@ -32,4 +34,12 @@ public void validateAmount(Payment payment) { | |
throw CustomException.NOT_MATCHING_SESSION_AMOUNT; | ||
} | ||
} | ||
|
||
public int getSessionAmount() { | ||
return sessionAmount; | ||
} | ||
|
||
public boolean getIsPremium() { | ||
return isPremium; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package nextstep.courses.domain; | ||
|
||
public interface SessionRepository { | ||
long save(Session session); | ||
Session findById(Long id); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
public enum SessionState { | ||
READY("READY"), START("START"), END("END"); | ||
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. enum 이름과 상태를 동일하게 적어주셨는데 |
||
|
||
public String getState() { | ||
return state; | ||
} | ||
|
||
public String state; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
package nextstep.courses.domain.sessionimage; | ||
package nextstep.courses.domain.image; | ||
|
||
public class SessionImage { | ||
|
||
private final ImageCapacity capacity; | ||
private final ImageType type; | ||
private final ImageSize size; | ||
|
||
|
||
public SessionImage(ImageCapacity capacity, ImageType type, ImageSize size) { | ||
ImageType.validateType(type.name()); | ||
this.capacity = capacity; | ||
this.type = type; | ||
this.size = size; | ||
} | ||
|
||
public ImageCapacity getCapacity() { | ||
return capacity; | ||
} | ||
|
||
public ImageType getType() { | ||
return type; | ||
} | ||
|
||
public ImageSize getSize() { | ||
return size; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
package nextstep.courses.Exception; | ||
package nextstep.courses.exception; | ||
|
||
public class CustomException extends RuntimeException { | ||
|
||
public static final CustomException NOT_ALLOWED_DATE = new CustomException(ResponseType.NOT_ALLOWED_DATE_MESSAGE); | ||
public static final CustomException OVER_MAX_IMAGE_CAPACITY = new CustomException(ResponseType.OVER_MAX_IMAGE_CAPACITY); | ||
public static final CustomException IMAGE_SIZE_ERROR = new CustomException(ResponseType.IMAGE_SIZE_ERROR); | ||
public static final CustomException IMAGE_PERCENT_ERROR = new CustomException(ResponseType.IMAGE_PERCENT_ERROR); | ||
public static final CustomException NOT_ALLOWED_PREMIUM_AMOUNT = new CustomException(ResponseType.NOT_ALLOWED_PREMIUM_AMOUNT); | ||
public static final CustomException NOT_ALLOWED_FREE_AMOUNT = new CustomException(ResponseType.NOT_ALLOWED_FREE_AMOUNT); | ||
public static final CustomException NOT_MATCHING_SESSION_AMOUNT = new CustomException(ResponseType.NOT_MACHING_SESSION_AMOUNT); | ||
public static final CustomException MAX_STUDENTS_OVER = new CustomException(ResponseType.MAX_STUDENTS_OVER); | ||
public static final CustomException INVALID_SESSION_STATE = new CustomException(ResponseType.INVALID_SESSION_STATE); | ||
public static final CustomException INVALID_IMAGE_TYPE = new CustomException(ResponseType.INVALID_IMAGE_TYPE); | ||
public static final CustomException NOT_ALLOWED_DATE = new CustomException("허용되지 않은 시작날짜입니다."); | ||
public static final CustomException OVER_MAX_IMAGE_CAPACITY = new CustomException("이미지 사이즈는 1MB 이하여야 합니다."); | ||
public static final CustomException IMAGE_SIZE_ERROR = new CustomException("이미지 사이즈 오류입니다."); | ||
public static final CustomException IMAGE_PERCENT_ERROR = new CustomException("이미지 비율 오류"); | ||
public static final CustomException NOT_ALLOWED_PREMIUM_AMOUNT = new CustomException("유료강의 금액은 0원이 될 수 없습니다."); | ||
public static final CustomException NOT_ALLOWED_FREE_AMOUNT = new CustomException("무료 강의 금액이 0원이 아닙니다."); | ||
public static final CustomException NOT_MATCHING_SESSION_AMOUNT = new CustomException("강의 금액과 맞지 않습니다."); | ||
public static final CustomException MAX_STUDENTS_OVER = new CustomException("수강인원 초과"); | ||
public static final CustomException INVALID_SESSION_STATE = new CustomException("강의신청 기간이 아닙니다."); | ||
public static final CustomException INVALID_IMAGE_TYPE = new CustomException("이미지 타입이 올바르지 않습니다."); | ||
|
||
public CustomException(ResponseType responseType) { | ||
super(responseType.message); | ||
public CustomException(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public synchronized Throwable fillInStackTrace() { | ||
return this; | ||
} | ||
|
||
|
||
} |
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.
연관관계를 가지도록 매핑하셨네요
Course를 조회하는 시점에 같이 조회해야하지 않을까요?
따로 Session 리스트를 주입하는 부분을 찾을 수 없는 것 같아서요