Hotfix/#211 최상단 카테고리 삭제 시 발생하는 이슈 해결 #212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
이슈 내용
2단을 삭제하면 3단이었던 카테고리는 1단인 카테고리를 부모 카테고리로 변경하는 것은 동작하는데
1단을 삭제하는 경우 2단이었던 카테고리가 1단으로, 즉 부모가 없도록 변경되어야하는데 그렇지 않고 삭제된 카테고리를 여전히 부모로 저장하고 있음
원인
부모 카테고리가 없는 1단 카테고리가 삭제되는 경우 하위 카테고리에게 undefined를 할당하여 부모 정보를 업데이트했는데, 이게 db에 반영되지 않아 null을 할당해야했음.
how-to-set-a-nullable-database-field-to-null-with-typeorm
위 내용을 참고하여 문제 해결