-
Notifications
You must be signed in to change notification settings - Fork 301
๐ 2๋จ๊ณ - ์๊ฐ์ ์ฒญ(๋๋ฉ์ธ ๋ชจ๋ธ) #691
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
base: nno0obb
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.
์๋ ํ์ธ์ ํ๊ท ๋ ๐
๋ช๊ฐ์ง ์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ผ๋ ํ์ธ๋ถํ๋๋ ค์ :)
๊ถ๊ธํ๊ฑฐ๋ ๊ณ ๋ฏผ์ด ๋๋ ๋ถ๋ถ์ด ์์ผ์๋ค๋ฉด ์ธ์ ๋ pr ์ฝ๋ฉํธ ๋๋ dm์ผ๋ก ์์ฒญ ๋ถํ๋๋ฆฝ๋๋ค.
๊ฐ์ฌํฉ๋๋ค ๐โโ๏ธ
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.
ํ ์คํธ ์ถ๊ฐ๋ ์์ ์ ์์ ๋กญ๊ฒ ์งํํด์ฃผ์ ๋ ๋ฉ๋๋ค ๐
org.gradle.java.home=/opt/homebrew/Cellar/openjdk@11/11.0.26/libexec/openjdk.jdk/Contents/Home | ||
# ๋ต, ์ ์ค์ ์ IDE ์์ Java ์คํ ํ๊ฒฝ์ ์ํด ํ์ํฉ๋๋ค. |
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.
์ด๊ฑธ ์ค์ ํ๊ฒ๋๋ฉด gradle์ ์คํํ๋ ๊ณผ์ ์์ ํด๋น path๊ฐ ๋น์ด์๋ ๋ค๋ฅธ ์ฌ๋์ ๊ฒฝ์ฐ์๋ ์คํ์ด ๋ถ๊ฐ๋ฅํ ๊ฒ ๊ฐ์์. ์ค์ ์๋ฒ์์๋ ๋๋ฝ๋๋ฉด ์คํ์ด ๋์ง ์์ ๊ฒ์ด๊ตฌ์.
์ดํ๋ฆฌ์ผ์ด์ ์คํ๊ณผ ๊ด๋ จ๋ gradle์ ์ค์ ํ ๋๋ ๊ฐ๋ฅํ๋ฉด ํน์ path์ ์์กดํ์ง ์๋ ๊ฒ์ด ์ข์ต๋๋ค :)
|
||
import javax.imageio.ImageIO; | ||
|
||
public class CourseCoverImage { |
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.
CourseCoverImage ๋ ์์ฒด์ ์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ๋ฃ์ด์ ํ ์คํธ ํ๋ ๊ฒ์ด ๋ง์๊น์?
"Image" ๊ด๋ จ ์๋ฐ ํด๋์ค๊น์ง ๊ณต๋ถํ๋ ๊ฒ์ ์๋ํ์ ๊ฒ์ธ์ง ๊ถ๊ธํฉ๋๋ค.
์๋ฐํด๋์ค๋ฅผ ํ์ตํ ์ ๋๊น์ง๋ ํ์์๊ณ , ์๊ตฌ๋ ๋ด์ฉ์ ์ด๋ฏธ์ง ๊ด๋ จ๋ ๋๋ฉ์ธ๋ก์ง์ ์ฒ๋ฆฌํ๋ ์ ๋๋ฉด ์ถฉ๋ถํ ๊ฒ ๊ฐ์ต๋๋ค ๐
@@ -124,6 +128,22 @@ public boolean isGuestUser() { | |||
} | |||
} | |||
|
|||
public void registerCourse(Course course) { |
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 ์ "func::registerCourse" ๋ฅผ ๋ฃ์๋๋ฐ ์ด ๋ถ๋ถ์ ์ด๋ป๊ฒ ํ ์คํธ๋ฅผ ํด์ผํ๋ ๊ฒ์ธ๊ฐ์?
๋ง์ํด์ฃผ์ ๋ด์ฉ์ ์ดํด๋ชปํ์ด์. NsUser.registerCourse
๋ฅผ ํ
์คํธํ๋ ๊ฒ์ NsUserTest
์์ ๋จ์ ํ
์คํธ๋ฅผ ๋ง๋ค์ด๋ณด๋ฉด ๋๋ ๊ฒ ์๋๊น์?
์กฐ๊ธ ๋ ์์ธํ๊ฒ ๋ง์ํด์ฃผ์๋ฉด ํ์ธํด๋ณด๊ฒ ์ต๋๋ค ๐
|
||
import nextstep.users.domain.NsUser; | ||
|
||
public class AttendeeList { |
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.
์ด๋ฅผ ์ํด
AttendeeList
๊ฐ ๊ผญ ํ์ํด์ง๊ฒ ๊ฐ์๋ฐ ์๊ตฌ์ฌํญ์๋ ๋ช ์๋์ด ์์ง ์์ง๋ง ๋๋ฆ๋๋ก ๊ตฌํํ๋ ๊ฒ๊น์ง๊ฐ ์ด๋ฒ ์คํ ์ ์๋์ผ๊น์?
์๊ตฌ์ฌํญ์๋ ์ด๋ค ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด๋ผ๋ผ๋ ๊ตฌํ๋ด์ฉ์ ๋ช ์ํ์ง ์๊ธฐ ๋๋ฌธ์ ํ๊ท ๋์ด ์๊ฐํด์ฃผ์๋ ๋ฐฉํฅ๋๋ก ๊ตฌํ์ ํด์ฃผ์๋ฉด ๋์ด์ :)
if (course.getAttendees().size() >= course.getMaxAttendees()) { | ||
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.
์ ๋ฃ ๊ฐ์๋ ๊ฐ์ ์ต๋ ์๊ฐ ์ธ์์ ์ด๊ณผํ ์ ์๋ค.
๋๊ฐ ์๊ฐ๋ฑ๋ก์ ๋ํ ๊ฒ์ ๊ฐ์ ธ๊ฐ๋๋์ ๋ํ ๊ฒ์ ๊ณ ๋ฏผํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ๐
"์๊ฐ"์ด๋ผ๋ ๊ฒ์ ๊ฐ์์ ํ์์ด ๋ค์ด๊ฐ๋ ๊ฒ์ด๋ฏ๋ก Course
์์ ์๊ฐํ๊ณ ์๋ ์ธ์์ ๋ค๊ณ ์๋ ๊ฒ์ด ๋ ์์ฐ์ค๋ฝ์ง ์์๊น์? ๊ทธ๋ผ Course.๋ฑ๋ก()
์์๋ ์ ๋ฃ๊ฐ์์ธ ๊ฒฝ์ฐ ์ด๋ฏธ ์๊ฐ์ต๋์ธ์์ด ๊ฐ๋์ฐฌ ์ผ์ด์ค์์ ์์ธ๋ฅผ ํฐํธ๋ฆฌ๋๋ก ํด์ค ์ ์์ ๊ฒ ๊ฐ๊ตฌ์ :)
if (course.getCourseStatus() == CourseStatus.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.
์ด๋ฐ ๋ก์ง๋ Course
์ ๋ค์ด๊ฐ๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
๊ฐ์์ ๋ํ ๊ฒ์ฆ ์ฑ
์ ์์ฒด๋ฅผ Course
์ ๋ฃ์ด์ฃผ๋ ๊ฑธ ๊ณ ๋ คํด๋ณด์๋ฉด ์ข๊ฒ ์ต๋๋ค ๐
private String imageFilePath; | ||
private File imageFile; | ||
|
||
private BufferedImage courseCoverImageData; |
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.
private String imageFilePath; | |
private File imageFile; | |
private BufferedImage courseCoverImageData; | |
private final String imageFilePath; | |
private final File imageFile; | |
private final BufferedImage courseCoverImageData; |
๋ถ๋ณํ ์ ์๊ฒ ๋ค์!
} | ||
|
||
if (courseCoverImageData.getWidth() < MIN_WIDTH || courseCoverImageData.getHeight() < MIN_HEIGHT) { | ||
throw new IllegalArgumentException("๊ฐ์ ์ปค๋ฒ ์ด๋ฏธ์ง๋ ์ต์ 300x200 ํฝ์ ์ด์์ด์ด์ผ ํฉ๋๋ค."); |
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.
์ด๋ฏธ์ง ํฌ๊ธฐ๋ 1MB ์ดํ์ฌ์ผ ํ๋ค.
๋ ์ถ๊ฐ๋๋ฉด ์ข๊ฒ ๋ค์ ๐
imageFilePath = DEFAULT_IMAGE_FILE_PATH; | ||
} | ||
|
||
if (Arrays.stream(SUPPORTED_IMAGE_EXTENSIONS).noneMatch(imageFilePath::endsWith)) { |
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.
๐
CourseCoverImage
๋ ์์ฒด์ ์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ๋ฃ์ด์ ํ ์คํธ ํ๋ ๊ฒ์ด ๋ง์๊น์?"Image" ๊ด๋ จ ์๋ฐ ํด๋์ค๊น์ง ๊ณต๋ถํ๋ ๊ฒ์ ์๋ํ์ ๊ฒ์ธ์ง ๊ถ๊ธํฉ๋๋ค.
NsUser
์ "func::registerCourse" ๋ฅผ ๋ฃ์๋๋ฐ ์ด ๋ถ๋ถ์ ์ด๋ป๊ฒ ํ ์คํธ๋ฅผ ํด์ผํ๋ ๊ฒ์ธ๊ฐ์?์ง์ ๊ฐ์, ์ ์ , ๋ชจ๋ ๋ง๋ค๋ฉด ๋๋ ๊ฒ์ผ๊น์?
์ด๋ฅผ ์ํด
AttendeeList
๊ฐ ๊ผญ ํ์ํด์ง๊ฒ ๊ฐ์๋ฐ ์๊ตฌ์ฌํญ์๋ ๋ช ์๋์ด ์์ง ์์ง๋ง ๋๋ฆ๋๋ก ๊ตฌํํ๋ ๊ฒ๊น์ง๊ฐ ์ด๋ฒ ์คํ ์ ์๋์ผ๊น์?