-
Notifications
You must be signed in to change notification settings - Fork 307
3단계 수강신청(DB) #800
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
Merged
Merged
3단계 수강신청(DB) #800
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
96d0c1f
feat: DDL 추가
yangseungin 4728ce8
docs: 3단계 내용정리
yangseungin 0a104ce
chore: 변수명 변경 student -> nsuser
yangseungin b0b1237
feat: image정보, session, 저장구현
yangseungin 960267f
feat: 같은 이미지 저장시 기존 이미지id를 사용하도록 수정
yangseungin cd42f4a
refactor: 하드코딩 값 제거
yangseungin cccd0ea
refactor: SessionRepository 분리
yangseungin 3d67ae9
feat: SessionService 수강기능 구현
yangseungin f976492
feat: CourseService 간단 조회 저장 구현
yangseungin 2d3befb
refactor: EnrollmentRepository 분리
yangseungin eba374b
refactor: 수강신청 시 세션전체를 가져오는 부분 개선
yangseungin c043e2d
refactor: EnrolledStudent 값객체 생성, Enrollment 리팩토링 및 Sessionservice의 e…
yangseungin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # 수강 신청 기능 | ||
|
|
||
| ## 2. 테이블 설계 | ||
| - [ ] 객체 구조(도메인 구조)를 가능한 유지하면서 DB 테이블과 매핑한다. | ||
| - [ ] 성능보다 도메인 로직 구현에 집중한다. | ||
|
|
||
| ### 2.1 session_image 테이블 | ||
| - 컬럼: id, file_size, image_type, width, height | ||
|
|
||
| ### 2.2 session 테이블 | ||
| - 컬럼: id, course_id, cohort, start_date, end_date, image_id, status, session_type, max_capacity, fee, created_at, updated_at | ||
| - Course와 1:N | ||
| - SessionImage와 N:1 | ||
|
|
||
| ### 2.3 session_enrollment 테이블 | ||
| - 컬럼: id, session_id, ns_user_id, enrolled_at | ||
| - Session과 1:N | ||
| - NsUser와 N:1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package nextstep.courses.domain; | ||
|
|
||
| public interface CourseRepository { | ||
| int save(Course course); | ||
| Long save(Course course); | ||
|
|
||
| Course findById(Long id); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/nextstep/courses/domain/session/EnrollmentRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package nextstep.courses.domain.session; | ||
|
|
||
| public interface EnrollmentRepository { | ||
| void save (Long sessionId, Long nsUserId); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/nextstep/courses/domain/session/SessionRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package nextstep.courses.domain.session; | ||
|
|
||
| public interface SessionRepository { | ||
| void save(Long courseId, Session session); | ||
|
|
||
| Sessions findByCourseId(Long courseId); | ||
|
|
||
| Long findSessionIdByCourseIdAndCohort(Long courseId, int cohort); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/nextstep/courses/infrastructure/JdbcEnrollmentRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package nextstep.courses.infrastructure; | ||
|
|
||
| import nextstep.courses.domain.session.EnrollmentRepository; | ||
| import org.springframework.jdbc.core.JdbcOperations; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.sql.Timestamp; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| @Repository("enrollmentRepository") | ||
| public class JdbcEnrollmentRepository implements EnrollmentRepository { | ||
| private JdbcOperations jdbcTemplate; | ||
|
|
||
| public JdbcEnrollmentRepository(JdbcOperations jdbcTemplate) { | ||
| this.jdbcTemplate = jdbcTemplate; | ||
| } | ||
|
|
||
| @Override | ||
| public void save(Long sessionId, Long nsUserId) { | ||
| String sql = "insert into session_enrollment (session_id, ns_user_id, enrolled_at) values(?, ?, ?)"; | ||
| jdbcTemplate.update(sql, sessionId, nsUserId, Timestamp.valueOf(LocalDateTime.now())); | ||
|
|
||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👍