mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: merge with dev
This commit is contained in:
parent
b678ac86e8
commit
3430cfdb3a
34 changed files with 3515 additions and 2600 deletions
3538
apps/api/poetry.lock
generated
3538
apps/api/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -195,16 +195,16 @@ async def delete_chapter(
|
|||
# RBAC check
|
||||
await rbac_check(request, chapter.chapter_uuid, current_user, "delete", db_session)
|
||||
|
||||
db_session.delete(chapter)
|
||||
db_session.commit()
|
||||
|
||||
# Remove all linked activities
|
||||
statement = select(ChapterActivity).where(ChapterActivity.id == chapter.id)
|
||||
# Remove all linked chapter activities
|
||||
statement = select(ChapterActivity).where(ChapterActivity.chapter_id == chapter.id)
|
||||
chapter_activities = db_session.exec(statement).all()
|
||||
|
||||
for chapter_activity in chapter_activities:
|
||||
db_session.delete(chapter_activity)
|
||||
db_session.commit()
|
||||
|
||||
# Delete the chapter
|
||||
db_session.delete(chapter)
|
||||
db_session.commit()
|
||||
|
||||
return {"detail": "chapter deleted"}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue