-
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
๐ 3๋จ๊ณ - ์๊ฐ์ ์ฒญ(DB ์ ์ฉ) #531
base: kimsunghyun1995
Are you sure you want to change the base?
Conversation
* ํ ์คํธ๋ ์ด๋
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.
DB ๋งคํ ์ ํ๋ค์. ๐
๋จ, ๋งคํํ ๋ ์๋ชป ์ดํดํ ๋ถ๋ถ์ด ์๋ ๊ฒ ๊ฐ์ ํผ๋๋ฐฑ ๋จ๊ฒผ์ด์.
pr์ ๋จ๊ธด ์ง๋ฌธ์ ๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ DB ๋งคํ์ ํ๋ ๊ฐ์ฒด์ ๋น์ง๋์ค ๋ก์ง์ ๊ตฌํ์ ๋ด๋นํ๋ ๋๋ฉ์ธ ๊ฐ์ฒด๋ฅผ ๋ถ๋ฆฌํ๋ฉด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์.
์ด๋ ๊ฒ ๊ตฌํํ ๊ฒฝ์ฐ ๋น์ง๋์ค ๋ก์ง ๊ตฌํ์ ๋ด๋นํ๋ ๋๋ฉ์ธ ๊ฐ์ฒด ์ค๊ณ๊ฐ DB ๋งคํ์ ์ํฅ์ ๋ฐ์ง ์์ ๊ฒ ๊ฐ์์.
this.id = id; | ||
this.maximumNumberOfParticipants = maximumNumberOfParticipants; | ||
this.sessionPrice = sessionPrice; | ||
this.sessionStatus = sessionStatus; | ||
this.nsUsers = nsUsers; |
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.
๋ถ ์์ฑ์๊ฐ ์ฃผ ์์ฑ์๋ฅผ ํธ์ถํ๋๋ก ๊ตฌํ
if (sessionStatus != SessionStatus.PREPARING) { | ||
throw new IllegalArgumentException("๊ฐ์๊ฐ ์ค๋น์ค์ด ์๋๋๋ค."); | ||
} |
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.
๋ฉ์๋ ์ด๋ฆ์ ์๊ฐ ์ ์ฒญ ๊ฐ๋ฅ ๊ธฐ๊ฐ์์ ๋ฌผ์ด๋ณด๊ณ ์๋๋ฐ ์์ธ์ฒ๋ฆฌ๋ฅผ ํ๋ ๊ฒ์ ๋ญ๊ฐ ์ด์ํจ
์๋์ ์๋ isParticipantsSession() ๋ฉ์๋๋ ๊ฐ๋ค.
๋ฉ์๋ ์ด๋ฆ์ ๋ฐ๊พธ๊ฑฐ๋ ์์ธ ์ฒ๋ฆฌ๋ฅผ ์์ ๋๊ฐ ์ ํํ๋ฉด ์ด๋จ๊น?
'}'; | ||
} | ||
|
||
} |
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.
Enrollment ๊ฐ์ฒด ๋์ถํ ์ ๐
@@ -18,6 +18,8 @@ public class NsUser { | |||
|
|||
private String email; | |||
|
|||
private long sessionId; |
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.
์ด์ ๊ฐ์ด ๊ตฌํํ ๊ฒฝ์ฐ NsUser : Session์ ๊ด๊ณ๋ 1 : n ๊ด๊ณ๋ก NsUser๋ ํ ๊ฐ์ Session๋ง ์๊ฐ ๊ฐ๋ฅํด ์ง๋ค.
NsUser : Session์ ๊ด๊ณ๋ m : n ๊ด๊ณ์ฌ์ผ ํ์ง ์์๊น?
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@JdbcTest | ||
class EnrollmentRepositoryTest { |
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.
RepositoryTest ํ
์คํธ์ ๊ฒฝ์ฐ ๊ตฌํ๊ณผ ์คํ ์ธก๋ฉด์์ ๋ง์ ๋น์ฉ์ด ๋ฐ์ํ๊ณ ์ ์ง๋ณด์ ๋น์ฉ ๋ํ ๋ฐ์ํ๋ค.
ํ์ฅ์์๋ DB์ ๋ํ ํ
์คํธ๋ฅผ ๊ตฌํํ๋ ๊ฒ์ด ์ข์๊น?
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.
์๋์ DB์ ๋ํ ํ
์คํธ๋ ๊ตณ์ด ํ ํ์๊ฐ ์์ด๋ณด์
๋๋ค!
๋ฟ๋ง ์๋๋ผ, JPA์ ์ฌ์ฉํ๋ค๋ฉด, ์ฟผ๋ฆฌ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ํ
์คํธ ์ฝ๋๋ฅผ ์์ฑํ ์ด์ ๊ฐ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
์๋ ํ์ธ์
3๋จ๊ณ DB์ ์ฉ PR ์ ๋๋ค.
๊ธฐ์กด์๋ ์ถ์ํด๋์ค Session์ ํตํด ์ ๋ฃ๊ฐ์์ ๋ฌด๋ฃ๊ฐ์ ํด๋์ค๋ฅผ ๋๋ด์๋๋ฐ,
์ถ์ํด๋์ค๋ฅผ DB์ ๋งคํ์ํค๋ ค๋ ์ด๋ ค์์ด ์์ด, ๊ธฐ์กด ํด๋์ค Session์ผ๋ก ๋งคํํ์์ต๋๋ค.
๋ค๋ฅธ ๋ฐฉ๋ฒ์ด ์์๊น์??
๊ฐ์ฌํฉ๋๋ค