크리에이터 팔로우 API

- 팔로우 / 언팔로우 / 알림 받기 / 알림 받지 않기 를 모두 처리할 수 있도록 수정
This commit is contained in:
2024-09-12 23:51:28 +09:00
parent 4c50143834
commit 1051846c5b
4 changed files with 28 additions and 11 deletions

View File

@@ -331,7 +331,7 @@ class MemberService(
}
@Transactional
fun creatorFollow(creatorId: Long, memberId: Long) {
fun creatorFollow(creatorId: Long, isNotify: Boolean, isActive: Boolean, memberId: Long) {
val creatorFollowing = creatorFollowingRepository.findByCreatorIdAndMemberId(
creatorId = creatorId,
memberId = memberId
@@ -340,9 +340,14 @@ class MemberService(
if (creatorFollowing == null) {
val creator = repository.findByIdOrNull(creatorId) ?: throw SodaException("크리에이터 정보를 확인해주세요.")
val member = repository.findByIdOrNull(memberId) ?: throw SodaException("로그인 정보를 확인해주세요.")
creatorFollowingRepository.save(CreatorFollowing(creator = creator, member = member))
val newCreatorFollowing = CreatorFollowing()
newCreatorFollowing.member = member
newCreatorFollowing.creator = creator
creatorFollowingRepository.save(newCreatorFollowing)
} else {
creatorFollowing.isActive = true
creatorFollowing.isNotify = isNotify
creatorFollowing.isActive = isActive
}
}