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

๐Ÿš€ 3๋‹จ๊ณ„ - ์ˆ˜๊ฐ•์‹ ์ฒญ(DB ์ ์šฉ) #531

Open
wants to merge 37 commits into
base: kimsunghyun1995
Choose a base branch
from

Conversation

kimsunghyun1995
Copy link

์•ˆ๋…•ํ•˜์„ธ์š”

3๋‹จ๊ณ„ DB์ ์šฉ PR ์ž…๋‹ˆ๋‹ค.

๊ธฐ์กด์—๋Š” ์ถ”์ƒํด๋ž˜์Šค Session์„ ํ†ตํ•ด ์œ ๋ฃŒ๊ฐ•์˜์™€ ๋ฌด๋ฃŒ๊ฐ•์˜ ํด๋ž˜์Šค๋ฅผ ๋‚˜๋ˆด์—ˆ๋Š”๋ฐ,
์ถ”์ƒํด๋ž˜์Šค๋ฅผ DB์™€ ๋งคํ•‘์‹œํ‚ค๋ ค๋‹ˆ ์–ด๋ ค์›€์ด ์žˆ์–ด, ๊ธฐ์กด ํด๋ž˜์Šค Session์œผ๋กœ ๋งคํ•‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ์žˆ์„๊นŒ์š”??

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค

Copy link
Contributor

@javajigi javajigi left a 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 ๋งคํ•‘์— ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š์„ ๊ฒƒ ๊ฐ™์•„์š”.

Comment on lines 25 to 29
this.id = id;
this.maximumNumberOfParticipants = maximumNumberOfParticipants;
this.sessionPrice = sessionPrice;
this.sessionStatus = sessionStatus;
this.nsUsers = nsUsers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ถ€ ์ƒ์„ฑ์ž๊ฐ€ ์ฃผ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•˜๋„๋ก ๊ตฌํ˜„

Comment on lines +42 to +44
if (sessionStatus != SessionStatus.PREPARING) {
throw new IllegalArgumentException("๊ฐ•์˜๊ฐ€ ์ค€๋น„์ค‘์ด ์•„๋‹™๋‹ˆ๋‹ค.");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฉ”์„œ๋“œ ์ด๋ฆ„์€ ์ˆ˜๊ฐ• ์‹ ์ฒญ ๊ฐ€๋Šฅ ๊ธฐ๊ฐ„์ž„์„ ๋ฌผ์–ด๋ณด๊ณ  ์žˆ๋Š”๋ฐ ์˜ˆ์™ธ์ฒ˜๋ฆฌ๋ฅผ ํ•˜๋Š” ๊ฒƒ์€ ๋ญ”๊ฐ€ ์–ด์ƒ‰ํ•จ
์•„๋ž˜์— ์žˆ๋Š” isParticipantsSession() ๋ฉ”์„œ๋“œ๋„ ๊ฐ™๋‹ค.
๋ฉ”์„œ๋“œ ์ด๋ฆ„์„ ๋ฐ”๊พธ๊ฑฐ๋‚˜ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๋ฅผ ์—†์• ๋˜๊ฐ€ ์„ ํƒํ•˜๋ฉด ์–ด๋–จ๊นŒ?

'}';
}

}
Copy link
Contributor

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;
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RepositoryTest ํ…Œ์ŠคํŠธ์˜ ๊ฒฝ์šฐ ๊ตฌํ˜„๊ณผ ์‹คํ–‰ ์ธก๋ฉด์—์„œ ๋งŽ์€ ๋น„์šฉ์ด ๋ฐœ์ƒํ•˜๊ณ  ์œ ์ง€๋ณด์ˆ˜ ๋น„์šฉ ๋˜ํ•œ ๋ฐœ์ƒํ•œ๋‹ค.
ํ˜„์žฅ์—์„œ๋„ DB์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„๊นŒ?

Copy link
Author

@kimsunghyun1995 kimsunghyun1995 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„๋‹ˆ์š” DB์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๋Š” ๊ตณ์ด ํ•  ํ•„์š”๊ฐ€ ์—†์–ด๋ณด์ž…๋‹ˆ๋‹ค!
๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, JPA์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ์ฟผ๋ฆฌ ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ์ด์œ ๊ฐ€ ์—†์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants