-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feat/accept student #103
Feat/accept student #103
Conversation
val user = userRepository.findByIdAndStateAndRoles(acceptedStudentReqDto.id, UserState.PENDING, mutableListOf(UserRole.ROLE_STUDENT)) | ||
?: throw UserNotFoundException() | ||
|
||
user.update(acceptedStudentReqDto.name, acceptedStudentReqDto.grade, acceptedStudentReqDto.classNum, acceptedStudentReqDto.num,acceptedStudentReqDto.gender) |
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.
saveํด์ผํ๋๊ฑฐ ์๋๊ฐ?
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.
๋ํฐ์ฒดํน๋๊ธฐ๋ํ๋๋ฐ, ์๋ฌด๋๋ saveํ๋๊ฒ ๋ ๋ ํ์ง @KimTaeO
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.
save ํ๊ฒ ๋ณ๊ฒฝํ์ต๋๋ค
67d33ca
src/main/kotlin/com/msg/gauth/domain/user/presentation/UserController.kt
Show resolved
Hide resolved
val user = userRepository.findByIdAndStateAndRoles(acceptedStudentReqDto.id, UserState.PENDING, mutableListOf(UserRole.ROLE_STUDENT)) | ||
?: throw UserNotFoundException() | ||
|
||
userRepository.save(user.update(acceptedStudentReqDto.name, acceptedStudentReqDto.grade, acceptedStudentReqDto.classNum, acceptedStudentReqDto.num,acceptedStudentReqDto.gender)) |
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.
์ด ๋ถ๋ถ ์ข ๊น๋ํ๊ฒ ๋ฐ๊ฟ์ฃผ์ธ์..
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.
๋ต ๋ฐ๊ฟจ์ต๋๋ค
5cca886
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.
ํ๋ก์ ํธ ์ฌ๋ฏธ์์ด ๋ณด์ฌ์ ๊ตฌ๊ฒฝ์์ต๋๋ค
@field: NotBlank | ||
val id: Long, | ||
@field: NotBlank | ||
val name: String, | ||
@field: NotBlank | ||
val gender: Gender, | ||
@field: NotBlank | ||
val grade: Int, | ||
@field: NotBlank | ||
val classNum: Int, | ||
@field: NotBlank | ||
val num: Int |
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.
@NotBlank
๋ String type์์๋ง ๋์ํฉ๋๋ค.
๊ณต์๋ฌธ์: https://javaee.github.io/javaee-spec/javadocs/javax/validation/constraints/NotBlank.html
์ถ๊ฐ๋ก non-nullableํ์
์์ null์ด request๋ก ๋ฐ๋๋ค๋ฉด MethodArgumentNotValidException
๊ฐ ์๋ ๋ค๋ฅธ exception์ด ๋ฐ์ํฉ๋๋ค (์ค๋๋์ ๊ธฐ์ต์ด ์ ์๋๋ค์)
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.
์๋ ์ hirecruit๋ผ๋ ํ๋ก์ ํธ๋ฅผ ํ์๋๋ฐ ์ ๋ kotlin์์ ๊พธ์ญ๊พธ์ญ bean validator ์ป๋ ๊ธฐ์ต์ด ์๋ค์ ์ฐธ๊ณ ํ์ธ์~
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.
์ผ๋จ ๊ตฌ๊ฒฝ์ค์๊ณ , ๋ฆฌ๋ทฐ๋ ๋ฌ์์ฃผ์
จ๋๋ฐ ์ถํ ๋ชจ์ต ๋ณด์ฌ๋๋ฆฌ๊ณ ๋ฆฌ๋ทฐ ์ฝ๋ฉํธ๋ ๋ฆ๊ฒ ๋จ ์ ๋ถ๋๋ฝ๋ค์ ๊ทธ๋๋ ์ด๋ฒ ๊ธฐํ๋ก ๊ฒ์ฆ ์ด๋
ธํ
์ด์
์ํ์ด ์์ฑ ํ ์ผ ์์ ๊ฒ ๊ฐ์ต๋๋ค..ใ
ใ
์ฌ๋ฐ๋ ๊ตฌ๊ฒฝ์ด์๊ธธ ๋ฐ๋ผ๊ฒ ์ต๋๋ท!
e553188
๐ก ๊ฐ์
ํ์ ํ์๊ฐ์ ์๋ฝ api ์์ฑ
๐ ์์ ๋ด์ฉ
๐ ๋ณ๊ฒฝ์ฌํญ
๐โโ๏ธ ์ง๋ฌธ์ฌํญ
โ๏ธ ์ฌ์ฉ๋ฒ
๐ธ ๊ธฐํ