Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] DELETE /category/:categoryId 카테고리 삭제 api #64

Merged
merged 7 commits into from
Jan 15, 2022

Conversation

jokj624
Copy link
Member

@jokj624 jokj624 commented Jan 14, 2022

카테고리 삭제 flow

  1. category db에서 해당 카테고리 soft delete
  2. content db에서 카테고리 개수가 1개인 콘텐츠만 delete
  3. category_content db에서 해당 카테고리 delete
  4. 쿼리문 탭 정렬 했음

개수가 1인 콘텐츠를 찾는 flow

  1. category_content db에서 해당 카테고리를 가진 content_id 를 불러와서 sub_content_id 로 묶는다.
  2. category_content content_idsub_content_idcontent_id 랑 같은 경우를 category_id, content_id 로 묶는다. => ca_content
  3. group byhaving 절을 사용하여 카테고리 개수를 카운팅을 한다. COUNT (ca_content.content_id) > 0)
  4. 해당 카운트가 1보다 작거나 같을 경우이면서 콘텐츠 아이디가 같을 경우 업데이트 한다.

@jokj624 jokj624 added 🚀 enhancement New feature or request priority 2️⃣ labels Jan 14, 2022
@jokj624 jokj624 self-assigned this Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants