Skip to content

Commit

Permalink
Merge pull request #55 from Team-pingping/feature/nonMemberPing
Browse files Browse the repository at this point in the history
[feat] ๊ฐœ๋ณ„ํ•‘์— ๋ชจ๋“  nonMember ์ถ”๊ฐ€
  • Loading branch information
sominyun authored Nov 22, 2024
2 parents 22a0db3 + 9320738 commit 5c68045
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
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) }
}
}

0 comments on commit 5c68045

Please sign in to comment.