test #1

Merged
klaus merged 94 commits from test into main 2023-08-16 02:30:37 +00:00
3 changed files with 5 additions and 9 deletions
Showing only changes of commit 771dbeced0 - Show all commits

View File

@ -66,11 +66,9 @@ class TokenProvider(
val lock = getOrCreateLock(memberId = memberId) val lock = getOrCreateLock(memberId = memberId)
lock.write { lock.write {
val memberToken = tokenRepository.findByIdOrNull(memberId) val memberToken = tokenRepository.findByIdOrNull(memberId)
?: MemberToken(id = memberId, tokenList = mutableListOf()) ?: MemberToken(id = memberId)
val memberTokenSet = memberToken.tokenList.toMutableSet() memberToken.tokenSet.add(token)
memberTokenSet.add(token)
memberToken.tokenList = memberTokenSet.toMutableList()
tokenRepository.save(memberToken) tokenRepository.save(memberToken)
} }
@ -89,7 +87,7 @@ class TokenProvider(
val memberToken = tokenRepository.findByIdOrNull(id = claims.subject.toLong()) val memberToken = tokenRepository.findByIdOrNull(id = claims.subject.toLong())
?: throw SodaException("로그인 정보를 확인해주세요.") ?: throw SodaException("로그인 정보를 확인해주세요.")
if (!memberToken.tokenList.contains(token)) throw SodaException("로그인 정보를 확인해주세요.") if (!memberToken.tokenSet.contains(token)) throw SodaException("로그인 정보를 확인해주세요.")
val member = repository.findByIdOrNull(id = claims.subject.toLong()) val member = repository.findByIdOrNull(id = claims.subject.toLong())
?: throw SodaException("로그인 정보를 확인해주세요.") ?: throw SodaException("로그인 정보를 확인해주세요.")

View File

@ -371,9 +371,7 @@ class MemberService(
val memberToken = tokenRepository.findByIdOrNull(memberId) val memberToken = tokenRepository.findByIdOrNull(memberId)
?: throw SodaException("로그인 정보를 확인해주세요.") ?: throw SodaException("로그인 정보를 확인해주세요.")
val memberTokenSet = memberToken.tokenList.toMutableSet() memberToken.tokenSet.remove(token)
memberTokenSet.remove(token)
memberToken.tokenList = memberTokenSet.toMutableList()
tokenRepository.save(memberToken) tokenRepository.save(memberToken)
} }
} }

View File

@ -7,5 +7,5 @@ import org.springframework.data.redis.core.RedisHash
data class MemberToken( data class MemberToken(
@Id @Id
val id: Long, val id: Long,
var tokenList: MutableList<String> var tokenSet: MutableSet<String> = mutableSetOf()
) )