-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] 켐페인 보낸 제안 조회 #118
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
Merged
[Feat] 켐페인 보낸 제안 조회 #118
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
32 changes: 32 additions & 0 deletions
32
...java/com/example/RealMatch/business/application/service/CampaignProposalQueryService.java
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,32 @@ | ||
| package com.example.RealMatch.business.application.service; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import com.example.RealMatch.business.domain.entity.CampaignProposal; | ||
| import com.example.RealMatch.business.domain.repository.CampaignProposalRepository; | ||
| import com.example.RealMatch.business.exception.BusinessErrorCode; | ||
| import com.example.RealMatch.business.presentation.dto.response.CampaignProposalDetailResponse; | ||
| import com.example.RealMatch.global.exception.CustomException; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class CampaignProposalQueryService { | ||
|
|
||
| private final CampaignProposalRepository campaignProposalRepository; | ||
|
|
||
| public CampaignProposalDetailResponse getProposalDetail( | ||
| Long userId, | ||
| UUID proposalId | ||
| ) { | ||
| CampaignProposal proposal = campaignProposalRepository.findByIdWithTags(proposalId) | ||
| .orElseThrow(() -> new CustomException(BusinessErrorCode.CAMPAIGN_PROPOSAL_NOT_FOUND)); | ||
|
|
||
| return CampaignProposalDetailResponse.from(proposal); | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,9 @@ | |||||||||
| public enum BusinessErrorCode implements BaseErrorCode { | ||||||||||
|
|
||||||||||
| // ===== 조회 ===== | ||||||||||
| CAMPAIGN_APPLY_ALREADY_APPLIED(HttpStatus.BAD_REQUEST, "CAMPAIGN_400_1", "이미 지원한 캠페인입니다."); | ||||||||||
| CAMPAIGN_APPLY_ALREADY_APPLIED(HttpStatus.BAD_REQUEST, "CAMPAIGN_400_1", "이미 지원한 캠페인입니다."), | ||||||||||
|
|
||||||||||
| CAMPAIGN_PROPOSAL_NOT_FOUND(HttpStatus.NOT_FOUND, "CAMPAIGN_404_1", "캠페인 지원 내역이 없습니다."); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제안 상세 조회 시 권한이 없는 사용자의 접근을 막기 위한 에러 코드를 추가하는 것이 좋습니다.
Suggested change
|
||||||||||
|
|
||||||||||
| private final HttpStatus status; | ||||||||||
| private final String code; | ||||||||||
|
|
||||||||||
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
Oops, something went wrong.
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파라미터가 사용되지 않고 있어, 인증된 사용자가 다른 사용자의 제안 정보를 조회할 수 있는 보안 취약점이 있습니다. 제안을 조회하기 전에 현재 사용자가 해당 제안(creator 또는 brand 소속)에 접근할 권한이 있는지 확인하는 로직을 추가해야 합니다.BusinessErrorCode에 제안한PROPOSAL_ACCESS_FORBIDDEN에러 코드를 사용하여 권한이 없는 경우 예외를 발생시키는 것을 권장합니다.