[FEAT] DELETE /category/:categoryId 카테고리 삭제 api #64
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.
카테고리 삭제 flow
category db
에서 해당 카테고리 soft deletecontent db
에서 카테고리 개수가 1개인 콘텐츠만 deletecategory_content db
에서 해당 카테고리 delete개수가 1인 콘텐츠를 찾는 flow
category_content db
에서 해당 카테고리를 가진content_id
를 불러와서sub_content_id
로 묶는다.category_content
내content_id
랑sub_content_id
내content_id
랑 같은 경우를category_id
,content_id
로 묶는다. =>ca_content
group by
와having
절을 사용하여 카테고리 개수를 카운팅을 한다.COUNT (ca_content.content_id) > 0)