-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] festival 도메인 분리 과정에서 발생한 버그 수정 및 예외 메시지 변경 #71
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,24 @@ | |
| import java.util.Collection; | ||
| import java.util.List; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.data.repository.query.Param; | ||
|
|
||
| public interface PlaceJpaRepository extends JpaRepository<Place, Long> { | ||
|
|
||
| List<Place> findAllByFestivalId(Long festivalId); | ||
|
|
||
| Integer countByIdIn(Collection<Long> ids); | ||
|
|
||
| List<Place> findAllByIdInAndFestivalId(Collection<Long> places, Long festivalId); | ||
| @Query("SELECT p FROM Place p " + | ||
| "WHERE p.id IN (:placeIds) " + | ||
| "AND p.festival.id = :festivalId " + | ||
| "AND p.festival.organization.id = :organizationId") | ||
| List<Place> findAllByIdInAndFestivalId( | ||
| @Param("placeIds") Collection<Long> places, | ||
|
Member
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. 오 Collection으로 받는군요..
Comment on lines
+16
to
+21
Member
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. 요게 그때 festivalId -> organizationId로 변경해야 하는 것 때문에 수정하신건가요?
Member
Author
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. 네 그때, organization에 포함되어있고, festival에도 포함되어 있는 Place를 조회해와야해요
|
||
| @Param("festivalId") Long festivalId, | ||
| @Param("organizationId") Long organizationId | ||
| ); | ||
|
|
||
| boolean existsByIdAndFestivalOrganizationId(Long placeId, Long organizationId); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,13 +78,13 @@ private void validateTimeTagNotInUse(TimeTag timeTag) { | |
|
|
||
| private void validateFestivalBelongsToOrganization(Long festivalId, Long organizationId) { | ||
| if (!festivalJpaRepository.existsByIdAndOrganizationId(festivalId, organizationId)) { | ||
| throw new BusinessException("해당 조직의 축제가 아닙니다.", HttpStatus.FORBIDDEN); | ||
| throw new BusinessException("접근 권한이 없습니다.", HttpStatus.FORBIDDEN); | ||
changuii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| private void validateTimeTagBelongsToOrganization(Long timeTagId, Long organizationId) { | ||
| if (!timeTagJpaRepository.existsByIdAndFestivalOrganizationId(timeTagId, organizationId)) { | ||
| throw new BusinessException("해당 조직의 시간 태그가 아닙니다.", HttpStatus.FORBIDDEN); | ||
| throw new BusinessException("접근 권한이 없습니다.", HttpStatus.FORBIDDEN); | ||
|
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. The exception message is changed to a generic message to avoid exposing internal details. This enhances security by preventing attackers from gaining specific information about authorization failures. Severity: Medium if (!timeTagJpaRepository.existsByIdAndFestivalOrganizationId(timeTagId, organizationId)) {
throw new BusinessException("접근 권한이 없습니다.", HttpStatus.FORBIDDEN);
}
Member
Author
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. 앞으로 이렇게 하기로 정했으니까 학습해 |
||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.