From 932073851794d1d18be1aebbb4892eceb7d5f397 Mon Sep 17 00:00:00 2001 From: sominyun Date: Fri, 22 Nov 2024 14:49:11 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#54=20=EA=B0=9C=EB=B3=84=ED=95=91?= =?UTF-8?q?=EC=97=90=20=EB=AA=A8=EB=93=A0=20nonMember=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ping/application/nonmember/NonMemberService.kt | 8 ++++---- .../domain/nonmember/repository/NonMemberRepository.kt | 2 ++ .../domain/jpa/repository/NonMemberJpaRepository.kt | 9 +++++++++ .../domain/repositoryImpl/NonMemberRepositoryImpl.kt | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) 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