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

[3차 과제] API 별 쿼리 개수 정리 #87

Open
airoca opened this issue Jan 24, 2025 · 0 comments
Open

[3차 과제] API 별 쿼리 개수 정리 #87

airoca opened this issue Jan 24, 2025 · 0 comments
Assignees

Comments

@airoca
Copy link
Collaborator

airoca commented Jan 24, 2025

✅ API 별 쿼리 개수 정리


▶️ 사용자 정보 조회 (3개)

  • userRepository.findByUserId

▶️ 수저 개수 정보 조회 (2개)

  • userRepository.findById
  • spoonBalanceRepository.findByUser

▶️ 지도 리스트 추가 (3개)

  • postRepository.findById
  • userRepository.findById
  • zzimPostRepository.save

▶️ 지도 리스트 카드뷰 조회 (3개)

  • zzimPostRepository.findByUser
  • photoRepository.findFirstByPost
  • postCategoryRepository.findByPost

▶️ 특정 장소 기준 지도 리스트 카드뷰 조회 (5개)

  • locationRepository.findById
  • zzimPostRepository.findByUser
  • userRepository.findById
  • photoRepository.findFirstByPost
  • postCategoryRepository.findByPost

▶️ 지도 리스트 장소 상세 조회 (5개)

  • userRepository.findById
  • zzimPostRepository.findByUser
  • postCategoryRepository.findByPost
  • zzimPostRepository.countByPost
  • photoRepository.findByPost

▶️ 지도 리스트 삭제 (3개)

  • userRepository.findById
  • postRepository.findById
  • zzimPostRepository.deleteByUserAndPost

▶️ 신고하기 (3개)

  • postRepository.findById
  • userRepository.findById
  • reportRepository.save

▶️ 게시물 조회 (9개)

  • postRepository.findById
  • userRepository.findById
  • postCategoryRepository.findByPost
  • categoryRepository.findByCategoryId
  • zzimPostRepository.countByPost
  • zzimPostRepository.existsByUserAndPost
  • scoopPostRepository.existsByUserAndPost
  • photoRepository.findByPost
  • menuRepository.findByPost

▶️ 게시물 등록 (14개)

  • userRepository.findById
  • categoryRepository.findById
  • placeRepository.save
  • postRepository.save
  • postCategoryRepository.save
  • forEach(menuRepository::save)
  • forEach(photoRepository::save)
  • activityRepository.findById
  • spoonBalanceRepository.findByUser
  • spoonBalanceRepository.save
  • spoonHistoryRepository.save
  • zzimPostRepository.save
  • followRepository.findByFollowing
  • feedRepository.saveAll

▶️ 전체 카테고리 종류 조회 (1개)

  • categoryRepository.findAll()

▶️ 음식 카테고리 종류 조회 (1개)

  • categoryRepository.findByCategoryType

▶️ 게시물 떠먹기 (8개)

  • postRepository.findById
  • userRepository.findById
  • spoonBalanceRepository.findByUser
  • scoopPostRepository.save
  • activityRepository.findById
  • spoonBalanceRepository.save
  • spoonHistoryRepository.save
  • feedRepository.deleteByUserAndPost

▶️ 피드 조회 (5개)

  • userRepository.findById
  • feedRepository.findByUser
  • postCategoryRepository.findByPost
  • postCategoryRepository.findByPost
  • zzimPostRepository.countByPost

▶️ 장소 검색 (Open API) (0개 - 외부 요청)

▶️ 장소 중복 검사 (2개)

  • postRepository.findByUser
  • placeRepository.existsByPlaceIdInAndLatitudeAndLongitude

▶️ 지역 검색 (1개)

  • locationRepository.findByLocationNameContaining

✅ 트랜잭션 전략

  • 기본적으로 하나의 비즈니스 로직에 포함된 여러 쿼리를 @Transaction으로 묶었는데, 이는 예상치 못한 동시성 이슈를 예방함과 동시에, 추후 리팩터링을 수월하게 하기 위한 선택이었습니다.

  • 추후 개선 방향은, 비즈니스 로직 내에서 @Transaction 외부로 빼도 무방하거나, 또는 심한 병목을 유발하는 로직을 분리하여 별도로 처리하는 것입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants