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

71 feat/student activity list #77

Merged
merged 12 commits into from
Oct 30, 2023
Merged

Conversation

KimTaeO
Copy link
Collaborator

@KimTaeO KimTaeO commented Oct 26, 2023

๐Ÿ’ก ๊ฐœ์š”

๋™์•„๋ฆฌ์™€ ๊ด€๊ณ„์—†์ด ํ•™์ƒ ํ™œ๋™ ์ „์ฒด๋ฅผ ์กฐํšŒํ•˜๋Š” api๋ฅผ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค

๐Ÿ“ƒ ์ž‘์—…๋‚ด์šฉ

  • Pageable์„ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ฐ›๋Š” queryAllStudentActivity service
  • QueryAllStudentActivity controller
  • QueryAllStudentResponse DTO

@KimTaeO KimTaeO added 1๏ธโƒฃ Priority: High ์šฐ์„ ์ˆœ์œ„ - ์ƒ โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ labels Oct 26, 2023
@KimTaeO KimTaeO self-assigned this Oct 26, 2023
@KimTaeO KimTaeO linked an issue Oct 26, 2023 that may be closed by this pull request
Comment on lines 6 to 12
data class QueryAllStudentActivityResponse(
val activityId: UUID,
val title: String,
val userId: UUID,
val userName: String,
val approveStatus: ApproveStatus
)
Copy link
Contributor

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๋ฅผ ์ƒ์„ฑํ•ด์„œ ๊ด€๋ฆฌํ•˜๋Š”๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๊ณตํ†ต DomainResponse๋กœ ์ฒ˜๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋‹ค 8f2228c

Comment on lines 62 to 64
fun queryAllStudentActivity(pageable: Pageable): ResponseEntity<Page<QueryAllStudentActivityResponse>> {
val result = studentActivityService.queryAllStudentActivity(pageable)
return ResponseEntity.status(HttpStatus.OK).body(result)
Copy link
Contributor

Choose a reason for hiding this comment

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

์—ฌ๊ธด ์™œ result์ธ๊ฐ€์š”? ๋‹ค๋ฅธ๊ณณ์—์„œ๋Š” response๋กœ ์“ฐ์ด๋Š”๋ฐ ์ผ๊ด€์„ฑ์„ ์ž˜ ๋งž์ถฐ์ฃผ์„ธ์š”

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค
e0668c1

Copy link
Collaborator

Choose a reason for hiding this comment

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

@KimTaeO ์•„์ง ๋ณ€๊ฒฝ ์•ˆ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!

Copy link
Collaborator Author

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

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 ์–ด๋…ธํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•ด ์ตœ๋Œ€ ๋ฐฐ์น˜ ์‚ฌ์ด์ฆˆ๋ฅผ ์ง€์ •ํ•ด์„œ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์„ ๊ณ ๋ คํ•ด๋ณด์…จ์œผ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

์ด ๊ธ€์„ ์ฐธ๊ณ ํ•ด๋ณด์„ธ์š”

Copy link
Collaborator Author

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

@KimTaeO KimTaeO merged commit 0a2f70c into master Oct 30, 2023
1 check passed
@KimTaeO KimTaeO deleted the 71-feat/student-activity-list branch October 30, 2023 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1๏ธโƒฃ Priority: High ์šฐ์„ ์ˆœ์œ„ - ์ƒ โœจ Feature ์‹ ๊ทœ ๊ธฐ๋Šฅ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ํ•™์ƒ ํ™œ๋™ ์ •๋ณด ๋ฆฌ์ŠคํŠธ
4 participants