-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature/379] 연락처 차단 목록 등록 및 매칭 알고리즘 반영 (#379)
* feat: 연락처 차단 목록 등록 및 매칭 알고리즘 반영 * feat: 코드 깨지는 것 수정 * feat: 코드리뷰 반영 * feat: 코드리뷰 반영2 * feat: 코드 깨진 것 수정
- Loading branch information
1 parent
10079f3
commit 4eb95d9
Showing
9 changed files
with
128 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
api/src/main/kotlin/com/nexters/bottles/api/user/facade/dto/BlockContactListRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.nexters.bottles.api.user.facade.dto | ||
|
||
data class BlockContactListRequest( | ||
val blockContacts: Set<String> = setOf<String>(), | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/kotlin/com/nexters/bottles/app/user/domain/BlockContact.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.nexters.bottles.app.user.domain | ||
|
||
import com.nexters.bottles.app.common.BaseEntity | ||
import javax.persistence.* | ||
|
||
@Entity | ||
class BlockContact( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val id: Long = 0L, | ||
|
||
val userId: Long, // 차단 등록한 유저 | ||
|
||
var phoneNumber: String, | ||
) : BaseEntity() { | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/kotlin/com/nexters/bottles/app/user/repository/BlockContactRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.nexters.bottles.app.user.repository | ||
|
||
import com.nexters.bottles.app.user.domain.BlockContact | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface BlockContactRepository : JpaRepository<BlockContact, Long> { | ||
|
||
fun findAllByUserId(userId: Long): List<BlockContact> | ||
|
||
fun findAllByPhoneNumber(phoneNumber: String): List<BlockContact> | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/kotlin/com/nexters/bottles/app/user/service/BlockContactListService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.nexters.bottles.app.user.service | ||
|
||
import com.nexters.bottles.app.user.domain.BlockContact | ||
import com.nexters.bottles.app.user.repository.BlockContactRepository | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
class BlockContactListService( | ||
private val blockContactListRepository: BlockContactRepository, | ||
) { | ||
|
||
@Transactional(readOnly = true) | ||
fun findAllByUserId(userId: Long): List<BlockContact> { | ||
return blockContactListRepository.findAllByUserId(userId) | ||
} | ||
|
||
@Transactional | ||
fun saveAll(newBlockContactList: List<BlockContact>) { | ||
blockContactListRepository.saveAll(newBlockContactList) | ||
} | ||
|
||
@Transactional | ||
fun deleteAll(newBlockContacts: List<BlockContact>) { | ||
blockContactListRepository.deleteAll(newBlockContacts) | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
fun findAllByPhoneNumber(phoneNumber: String): List<BlockContact> { | ||
return blockContactListRepository.findAllByPhoneNumber(phoneNumber) | ||
} | ||
} |