-
Notifications
You must be signed in to change notification settings - Fork 0
[WTH-474] 페널티 유저 api 구현 #98
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
Merged
The head ref may contain hidden characters: "fix/WTH-474-\uD398\uB110\uD2F0-\uC720\uC800-api-\uAD6C\uD604"
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3f56832
feat: 마이페이지 stats에 페널티 수 추가
woneeeee 5c2f33d
feat: UserMyPageMapper에 페널티 매핑 추가
woneeeee 3ce2c89
feat: GetUserMyPageQueryService에 페널티 수 조회 추가
woneeeee 151e112
feat: UserMyPenaltyResponse DTO 추가
woneeeee 773b18f
feat: GetUserPenaltyQueryService 추가
woneeeee 2d9cc05
feat: 마이페이지 페널티 목록 및 규정 조회 API 추가
woneeeee 64e414b
test: ClubMemberMyPageController 페널티 엔드포인트 테스트 추가
woneeeee 42246be
fix: 페널티 규정 조회 시 동아리 멤버 여부 검증 추가
woneeeee 588f55b
fix: GetUserPenaltyQueryService @Transactional 클래스 레벨로 이동
woneeeee f0f88eb
chore: CI 트리거
woneeeee 35e3964
fix: GetPenaltyRuleQueryServiceTest clubMemberPolicy mock 추가
woneeeee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/weeth/domain/user/application/dto/response/UserMyPenaltyResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.weeth.domain.user.application.dto.response | ||
|
|
||
| import com.weeth.domain.penalty.domain.enums.PenaltyType | ||
| import io.swagger.v3.oas.annotations.media.Schema | ||
| import java.time.LocalDateTime | ||
|
|
||
| data class UserMyPenaltyResponse( | ||
| @field:Schema(description = "페널티 ID", example = "1") | ||
| val penaltyId: Long, | ||
| @field:Schema(description = "페널티 점수", example = "2") | ||
| val score: Int, | ||
| @field:Schema(description = "페널티 사유", example = "정기모임 무단 불참") | ||
| val penaltyDescription: String, | ||
| @field:Schema(description = "페널티 타입", example = "PENALTY") | ||
| val penaltyType: PenaltyType, | ||
| @field:Schema(description = "페널티 부여 일시", example = "2026-02-19T01:00:00") | ||
| val createdAt: LocalDateTime, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...main/kotlin/com/weeth/domain/user/application/usecase/query/GetUserPenaltyQueryService.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package com.weeth.domain.user.application.usecase.query | ||
|
|
||
| import com.weeth.domain.club.domain.service.ClubMemberPolicy | ||
| import com.weeth.domain.penalty.domain.repository.PenaltyReader | ||
| import com.weeth.domain.user.application.dto.response.UserMyPenaltyResponse | ||
| import com.weeth.domain.user.application.exception.UserPageNotFoundException | ||
| import com.weeth.global.common.response.SliceResponse | ||
| import org.springframework.data.domain.PageRequest | ||
| import org.springframework.stereotype.Service | ||
| import org.springframework.transaction.annotation.Transactional | ||
|
|
||
| @Service | ||
| @Transactional(readOnly = true) | ||
| class GetUserPenaltyQueryService( | ||
| private val penaltyReader: PenaltyReader, | ||
| private val clubMemberPolicy: ClubMemberPolicy, | ||
| ) { | ||
| fun getMyPenalties( | ||
| userId: Long, | ||
| clubId: Long, | ||
| pageNumber: Int, | ||
| pageSize: Int, | ||
| ): SliceResponse<UserMyPenaltyResponse> { | ||
| if (pageNumber < 0 || pageSize !in 1..MAX_PAGE_SIZE) throw UserPageNotFoundException() | ||
|
|
||
| val clubMember = clubMemberPolicy.getActiveMember(clubId, userId) | ||
| val pageable = PageRequest.of(pageNumber, pageSize) | ||
| val penalties = penaltyReader.findSliceByClubMemberId(clubMember.id, pageable) | ||
|
|
||
| return SliceResponse.from( | ||
| penalties.map { penalty -> | ||
| UserMyPenaltyResponse( | ||
| penaltyId = penalty.id, | ||
| score = penalty.score, | ||
| penaltyDescription = penalty.penaltyDescription, | ||
| penaltyType = penalty.penaltyType, | ||
| createdAt = penalty.createdAt, | ||
| ) | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| companion object { | ||
| private const val MAX_PAGE_SIZE = 50 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
userId도 파라미터로 넘겨서 사용자가 가입한 동아리인지를 확인하는(정책) 로직도 있어야 할 것 같아요!
Uh oh!
There was an error while loading. Please reload this page.
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.
말씀해주신대로
userId를 서비스로 전달해서ClubMemberPolicy를 통해서 활성 멤버 검증 로직 추가했슴니다!!