Skip to content

Commit

Permalink
feat :: isAdmin 필드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunSu1768 committed May 8, 2024
1 parent 5faa9cb commit 76e32c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ data class DetailTeamResponse(
val memberCount: Int,
val adminName: String,
val createdAt: LocalDateTime,
val memberList: List<TeamMemberResponse>
val memberList: List<TeamMemberResponse>,
val isAdmin: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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.team.adapter.dto.response.DetailTeamResponse
import xquare.app.xquareinfra.domain.team.adapter.dto.response.TeamMemberResponse
import xquare.app.xquareinfra.domain.team.application.port.`in`.GetTeamDetailUseCase
Expand All @@ -15,10 +16,12 @@ import java.util.*
@Service
class GetTeamDetailService(
private val findTeamPort: FindTeamPort,
private val findUserPort: FindUserPort
private val findUserPort: FindUserPort,
private val readCurrentUserPort: ReadCurrentUserPort
): GetTeamDetailUseCase {
override fun getTeamDetail(teamId: UUID): DetailTeamResponse {
val team = findTeamPort.findById(teamId) ?: throw BusinessLogicException.TEAM_NOT_FOUND
val user = readCurrentUserPort.readCurrentUser()
val response = team.run {
val admin = findUserPort.findById(adminId) ?: throw BusinessLogicException.USER_NOT_FOUND
DetailTeamResponse(
Expand All @@ -27,7 +30,8 @@ class GetTeamDetailService(
memberCount = members.size,
adminName = admin.name,
createdAt = createdAt!!,
memberList = getMemberResponse(members)
memberList = getMemberResponse(members),
isAdmin = team.adminId == user.id!!
)
}
return response
Expand Down

0 comments on commit 76e32c1

Please sign in to comment.