Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 개별핑에 모든 nonMember 추가 #55

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ interface NonMemberRepository {
fun findAllByShareUrl(shareUrlId: Long): List<NonMemberDomain>

fun findById(nonMemberId: Long): NonMemberDomain?

fun findAllBySidAndShareUrlId(sid: String, sharedUrlId: Long): List<NonMemberDomain>
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<NonMemberEntity, Long> {
fun findByShareUrlIdAndName(urlId: Long, name: String): NonMemberEntity?

fun findAllByShareUrlId(shareUrlId: Long): List<NonMemberEntity>

@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<NonMemberEntity>
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ class NonMemberRepositoryImpl(
NonMemberMapper.toDomain(it)
}
}

override fun findAllBySidAndShareUrlId(sid: String, sharedUrlId: Long): List<NonMemberDomain> {
return nonMemberJpaRepository.findAllBySidAndShareUrlId(sid, sharedUrlId).map { NonMemberMapper.toDomain(it) }
}
}