-
Notifications
You must be signed in to change notification settings - Fork 0
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
71 feat/student activity list #77
Conversation
data class QueryAllStudentActivityResponse( | ||
val activityId: UUID, | ||
val title: String, | ||
val userId: UUID, | ||
val userName: String, | ||
val approveStatus: ApproveStatus | ||
) |
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.
์์ ์ค๋ช ํด๋๋ ธ์ด์ผํ๋๋ฐ Response๋ ๊ณตํต DomainResponse ์คํฌ๋ฆฝํธ์ ๊ด๋ฆฌํ๋๊ฒ ๋ง๋ ๊ฒ ๊ฐ์์ ๊ธฐ๋ณธ ์ธ์๋ฅผ ๊ฐ์ง๊ณ ์๋ DomainResponse์ ListResponse, DetailResponse ํด๋์ค๋ฅผ ํ ์คํฌ๋ฆฝํธ์ ๊ฐ์ด ์ฝ์ ํ๊ณ companion object์ ์ ์๋ of ํจ์๋ฅผ ํตํด response๋ฅผ ์์ฑํด์ ๊ด๋ฆฌํ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
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.
๊ณตํต DomainResponse๋ก ์ฒ๋ฆฌํ์์ต๋๋ค 8f2228c
fun queryAllStudentActivity(pageable: Pageable): ResponseEntity<Page<QueryAllStudentActivityResponse>> { | ||
val result = studentActivityService.queryAllStudentActivity(pageable) | ||
return ResponseEntity.status(HttpStatus.OK).body(result) |
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.
์ฌ๊ธด ์ result์ธ๊ฐ์? ๋ค๋ฅธ๊ณณ์์๋ response๋ก ์ฐ์ด๋๋ฐ ์ผ๊ด์ฑ์ ์ ๋ง์ถฐ์ฃผ์ธ์
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.
๋ณ๊ฒฝํ์์ต๋๋ค
e0668c1
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.
@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.
์ด๋ฒ์๋ ์ ๋ง ๋ณ๊ฒฝํ์ต๋๋ค
06268d5
override fun queryAllStudentActivity(pageable: Pageable): Page<QueryAllStudentActivityResponse> { | ||
val user = userUtil.queryCurrentUser() | ||
|
||
val studentActivities = studentActivityRepository.findAll(pageable) |
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.
ToOne ๊ด๊ณ์์๋ ํ์ด์ง ๊ด๋ จ ์กฐํ๋ผ๋ ์กฐ์ธ์ ์ฌ์ฉํด์ N + 1์ ํด๊ฒฐํด๋๋๋ฉฐ @EntityGraph
๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ ๋ฐฉ๋ฒ์ผ ์ ์์ต๋๋ค. ์ถ๊ฐ๋ก @BatchSize
์ด๋
ธํ
์ด์
์ ์ฌ์ฉํด ์ต๋ ๋ฐฐ์น ์ฌ์ด์ฆ๋ฅผ ์ง์ ํด์ ์ฑ๋ฅ์ ํฅ์์ํค๋ ์ฌ๋ฌ๊ฐ์ง ๋ฐฉ๋ฒ์ ๊ณ ๋ คํด๋ณด์
จ์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค.
์ด ๊ธ์ ์ฐธ๊ณ ํด๋ณด์ธ์
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.
์ผ๋จ์ StudentActivityRepository์์ findAllํ ๊ฒฝ์ฐ์ @entitygraph๋ฅผ ํตํ์ฌ N+1 ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์์ผ๋ฉฐ, @batchsize๋ ~ToMany๊ด๊ณ์์ ์ฌ์ฉ์ ์ฃผ๋ก ํ๋ค๊ณ ํ๋๊ตฐ์. ๋์ค์ ์ ์ฒด ์กฐํ๊ฐ ์๋ ํ์ ์กฐํ๋ฅผ ํ๊ฒ ๋๋ค๋ฉด ํ์๊ณผ ํ์ํ๋ ๊ฐ์ ์๋ฐฉํฅ ๋งคํ์ ํ์ฌ ์ ์ฉ์ ํ๋ ๊ฒ์ ๊ณ ๋ ค ํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค ๊ทธ๋ฆฌ๊ณ ๋ค๋ฅธ ์ฝ๋์์๋ N + 1 ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ์ฝ๋๋ค์ด ์๋๊ตฐ์ ๊ทธ ๋ถ๋ถ์ ๋ฐ๋ก Issue๋ฅผ ํตํด ํด๊ฒฐํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค
0f7b5f4
๐ก ๊ฐ์
๋์๋ฆฌ์ ๊ด๊ณ์์ด ํ์ ํ๋ ์ ์ฒด๋ฅผ ์กฐํํ๋ api๋ฅผ ์์ฑํ์์ต๋๋ค
๐ ์์ ๋ด์ฉ