Skip to content

Commit

Permalink
feat :: 배포 리스트 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSu1768 committed May 7, 2024
1 parent 86ae284 commit b53ed55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ data class SimpleTeamResponse(
val teamNameKo: String,
val teamNameEn: String,
val administratorName: String,
val teamType: TeamType
val teamType: TeamType,
val deployList: List<String>
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package xquare.app.xquareinfra.domain.team.application.service
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import xquare.app.xquareinfra.domain.auth.application.port.out.ReadCurrentUserPort
import xquare.app.xquareinfra.domain.deploy.application.port.out.FindDeployPort
import xquare.app.xquareinfra.domain.team.adapter.dto.response.SimpleTeamResponse
import xquare.app.xquareinfra.domain.team.adapter.dto.response.SimpleTeamResponseList
import xquare.app.xquareinfra.domain.team.application.port.`in`.GetMyTeamUseCase
Expand All @@ -13,19 +14,23 @@ import xquare.app.xquareinfra.infrastructure.exception.BusinessLogicException
@Service
class GetMyTeamService(
private val readCurrentUserPort: ReadCurrentUserPort,
private val findUserPort: FindUserPort
private val findUserPort: FindUserPort,
private val findDeployPort: FindDeployPort
): GetMyTeamUseCase {
override fun getMyTeam(): SimpleTeamResponseList {
val user = readCurrentUserPort.readCurrentUser()

val teamList = user.teams.takeUnless { it.isEmpty() }?.map { userTeam ->
val deploys = findDeployPort.findAllByTeam(userTeam.team)
val admin = findUserPort.findById(userTeam.team.adminId) ?: throw BusinessLogicException.USER_NOT_FOUND
SimpleTeamResponse(
teamId = userTeam.team.id!!,
teamType = userTeam.team.teamType,
teamNameKo = userTeam.team.teamNameKo,
teamNameEn = userTeam.team.teamNameEn,
administratorName = admin.name
administratorName = admin.name,
deployList = deploys.map { it.deployName }

)
} ?: arrayListOf()

Expand Down

0 comments on commit b53ed55

Please sign in to comment.