Skip to content

Commit

Permalink
#11 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chs98412 committed Oct 7, 2024
1 parent 9e36c64 commit d0c5869
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class CoupleCommandService(
}

suspend fun createCouple(command: CoupleCreateCommand) {
val memberNo = redisTemplate.opsForValue().getAndAwait(command.inviteCode) ?: throw InvalidInviteCodeException("유효하지 않은 초대코드입니다.")
coupleRepository.findByAccountNoAOrAccountNoB(memberNo.toInt(), command.accountNoB)?.let {
val memberNo = redisTemplate.opsForValue().getAndAwait(command.inviteCode)?.toInt() ?: throw InvalidInviteCodeException("유효하지 않은 초대코드입니다.")
coupleRepository.findByAccountNoAOrAccountNoB(memberNo, command.accountNoB)?.let {
throw CoupleExistException("이미 커플이 존재하는 회원입니다.")
}
coupleRepository.save(Couple.create(command))
coupleRepository.save(Couple.create(memberNo,command.accountNoB))
}

fun modifyCoupleInfo(memberNo: Int, command: CoupleInfoModifyCommand) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class Couple(
}

companion object {
fun create(command: CoupleCreateCommand)=Couple(
accountNoA = command.accountNoA,
accountNoB = command.accountNoB
fun create(accountNoA:Int,accountNoB:Int)=Couple(
accountNoA = accountNoA,
accountNoB = accountNoB
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ package com.yedongsoon.account_service.domain.member.model

data class CoupleCreateCommand(
val inviteCode:String,
val accountNoA: Int?=null,
val accountNoB: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.yedongsoon.account_service.infrastructure

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory
import org.springframework.data.redis.core.ReactiveRedisTemplate
import org.springframework.data.redis.serializer.RedisSerializationContext
Expand All @@ -11,6 +12,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer
class RedisConfig {

@Bean
@Primary
fun reactiveRedisTemplate(factory: ReactiveRedisConnectionFactory): ReactiveRedisTemplate<String, String> {
val serializationContext = RedisSerializationContext
.newSerializationContext<String, String>(StringRedisSerializer())
Expand Down

0 comments on commit d0c5869

Please sign in to comment.