diff --git a/Ping-Application/src/main/kotlin/com/ping/application/nonmember/NonMemberService.kt b/Ping-Application/src/main/kotlin/com/ping/application/nonmember/NonMemberService.kt index f0100f4..26143c7 100644 --- a/Ping-Application/src/main/kotlin/com/ping/application/nonmember/NonMemberService.kt +++ b/Ping-Application/src/main/kotlin/com/ping/application/nonmember/NonMemberService.kt @@ -126,15 +126,15 @@ class NonMemberService( val bookmarks = bookmarkRepository.findAllBySidIn(nonMemberPlaces.map { it.sid }) return GetNonMemberPing.Response( pings = bookmarks.map { + val nonMembers = nonMemberRepository.findAllBySidAndShareUrlId(it.sid, nonMember.shareUrlDomain.id) GetAllNonMemberPings.Ping( iconLevel = 0, - nonMembers = listOf( + nonMembers = nonMembers.map { nonMember-> GetAllNonMemberPings.NonMember( - nonMemberId = nonMemberId, + nonMemberId = nonMember.id, name = nonMember.name, profileSvg = nonMember.profileSvg, - ) - ), + )}, url = it.url, placeName = it.name, px = it.px, diff --git a/Ping-Domain/src/main/kotlin/com/ping/domain/nonmember/repository/NonMemberRepository.kt b/Ping-Domain/src/main/kotlin/com/ping/domain/nonmember/repository/NonMemberRepository.kt index f262150..f18cf5f 100644 --- a/Ping-Domain/src/main/kotlin/com/ping/domain/nonmember/repository/NonMemberRepository.kt +++ b/Ping-Domain/src/main/kotlin/com/ping/domain/nonmember/repository/NonMemberRepository.kt @@ -10,4 +10,6 @@ interface NonMemberRepository { fun findAllByShareUrl(shareUrlId: Long): List fun findById(nonMemberId: Long): NonMemberDomain? + + fun findAllBySidAndShareUrlId(sid: String, sharedUrlId: Long): List } \ No newline at end of file diff --git a/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/jpa/repository/NonMemberJpaRepository.kt b/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/jpa/repository/NonMemberJpaRepository.kt index 78eff2e..8fd7418 100644 --- a/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/jpa/repository/NonMemberJpaRepository.kt +++ b/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/jpa/repository/NonMemberJpaRepository.kt @@ -2,9 +2,18 @@ package com.ping.infra.nonmember.domain.jpa.repository import com.ping.infra.nonmember.domain.jpa.entity.NonMemberEntity import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.data.jpa.repository.Query interface NonMemberJpaRepository : JpaRepository { fun findByShareUrlIdAndName(urlId: Long, name: String): NonMemberEntity? fun findAllByShareUrlId(shareUrlId: Long): List + + @Query(""" + select n + from non_member n + join non_member_place pc on n.id = pc.nonMember.id + where n.shareUrl.id = :shareUrlId and pc.sid=:sid + """) + fun findAllBySidAndShareUrlId(sid: String, shareUrlId: Long): List } \ No newline at end of file diff --git a/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/repositoryImpl/NonMemberRepositoryImpl.kt b/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/repositoryImpl/NonMemberRepositoryImpl.kt index a8195eb..c88cace 100644 --- a/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/repositoryImpl/NonMemberRepositoryImpl.kt +++ b/Ping-Infra/src/main/kotlin/com/ping/infra/nonmember/domain/repositoryImpl/NonMemberRepositoryImpl.kt @@ -29,4 +29,8 @@ class NonMemberRepositoryImpl( NonMemberMapper.toDomain(it) } } + + override fun findAllBySidAndShareUrlId(sid: String, sharedUrlId: Long): List { + return nonMemberJpaRepository.findAllBySidAndShareUrlId(sid, sharedUrlId).map { NonMemberMapper.toDomain(it) } + } } \ No newline at end of file