Skip to content

Commit

Permalink
[#168] fix(exitRootFolder) : 보관함에서 나갈 때, 로직을 제대로 돌아도 나가지지 않던 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji-Ha committed Aug 14, 2022
1 parent 76e6feb commit 3c2e9e9
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class AccountService(
val folderId = jwtProvider.getIdFromToken(folderToken)
val rootFolder = folderService.findByFolderId(folderId)

if (rootFolder.rootFolderId != null) throw FolderNotRootException()
if (rootFolder.rootFolderId != folderId) throw FolderNotRootException()

val accountFolder = AccountFolder(account, rootFolder)
accountFolder.changeAuthority(Authority.INVITEE)
Expand All @@ -206,14 +206,18 @@ class AccountService(
rootFolder.folders?.add(accountFolder)
}


@Transactional
fun exitSharedFolder(folderId: Long, token: String) {
val account = jwtProvider.getAccountFromToken(token)
val folder = folderService.findByFolderId(folderId)
var exitFolder = folder.rootFolderId?.let {
folderService.findByFolderId(it)
} ?: folder

exitFolder.folders?.let {
it.removeIf { x -> x.account == account }
}

account.removeFolderInAccountFolder(exitFolder)
}

Expand Down

0 comments on commit 3c2e9e9

Please sign in to comment.