Skip to content

Commit

Permalink
⚡️ :: 신청자 목록 조회 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jyk1029 committed Nov 21, 2023
1 parent da03084 commit 9ea21af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ import java.util.*

interface ApplyRepository: JpaRepository<Apply, UUID> {
fun findAllByUserOrderByAppliedAtDesc(user: User): List<ApplyElement>
fun findAllByFeedId(feedId: UUID): List<Apply>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.sharing.domain.feed.presentation

import com.example.sharing.domain.feed.domain.Apply
import com.example.sharing.domain.feed.presentation.dto.request.CreateFeedRequest
import com.example.sharing.domain.feed.presentation.dto.request.QueryAddressRequest
import com.example.sharing.domain.feed.presentation.dto.request.QueryFeedByMapRequest
Expand All @@ -10,6 +11,7 @@ import com.example.sharing.domain.feed.presentation.dto.response.QueryAddressRes
import com.example.sharing.domain.feed.presentation.dto.response.QueryFeedDetailResponse
import com.example.sharing.domain.feed.service.CreateFeedService
import com.example.sharing.domain.feed.service.DeleteFeedService
import com.example.sharing.domain.feed.service.QueryApplicantService
import com.example.sharing.domain.feed.service.QueryEmergencyFeedService
import com.example.sharing.domain.feed.service.QueryFeedByInterestAreaService
import com.example.sharing.domain.feed.service.QueryFeedByViewsService
Expand Down Expand Up @@ -51,6 +53,7 @@ class FeedController(
private val queryMyApplyFeedListService: QueryMyApplyFeedListService,
private val queryEmergencyFeedService: QueryEmergencyFeedService,
private val searchTitleFeedService: SearchTitleFeedService,
private val queryApplicantService: QueryApplicantService,
) {

@ResponseStatus(CREATED)
Expand Down Expand Up @@ -121,4 +124,9 @@ class FeedController(
fun getSearchTitle(@RequestParam("keyword") keyword: String): QueryFeedDetailResponse {
return searchTitleFeedService.execute(keyword)
}

@GetMapping("/applicant/{feed-id}")
fun getApplicant(@PathVariable("feed-id") feedId: UUID): List<Apply> {
return queryApplicantService.execute(feedId)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.sharing.domain.feed.service

import com.example.sharing.domain.feed.domain.Apply
import com.example.sharing.domain.feed.domain.repository.ApplyRepository
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.util.*

@Service
class QueryApplicantService(
private val applyRepository: ApplyRepository
) {
@Transactional(readOnly = true)
fun execute(feedId: UUID): List<Apply> {
return applyRepository.findAllByFeedId(feedId)
}
}

0 comments on commit 9ea21af

Please sign in to comment.