Skip to content

Conversation

@hou27
Copy link
Member

@hou27 hou27 commented Nov 1, 2023

이슈 내용

2단을 삭제하면 3단이었던 카테고리는 1단인 카테고리를 부모 카테고리로 변경하는 것은 동작하는데
1단을 삭제하는 경우 2단이었던 카테고리가 1단으로, 즉 부모가 없도록 변경되어야하는데 그렇지 않고 삭제된 카테고리를 여전히 부모로 저장하고 있음

원인

부모 카테고리가 없는 1단 카테고리가 삭제되는 경우 하위 카테고리에게 undefined를 할당하여 부모 정보를 업데이트했는데, 이게 db에 반영되지 않아 null을 할당해야했음.


how-to-set-a-nullable-database-field-to-null-with-typeorm

위 내용을 참고하여 문제 해결

hou27 added 3 commits November 1, 2023 17:43
parentId property에 null이 할당 가능하도록
postgres용 type과 typescript용 type을 각각 따로 명시
하위 카테고리가 있는 경우 삭제되는 카테고리의 부모 카테고리를 위임했었음.
이때 1단 카테고리기 때문에 부모 카테고리가 없는 경우 null을 할당하도록 함.
@hou27 hou27 added bug Something isn't working enhancement New feature or request labels Nov 1, 2023
@hou27 hou27 added this to the v1.0.0 milestone Nov 1, 2023
@hou27 hou27 self-assigned this Nov 1, 2023
@hou27 hou27 merged commit b59ced6 into develop Nov 1, 2023
@hou27 hou27 deleted the hotfix-#211-delete-child-category branch November 1, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants