Handle deletion cascade (organizations, cameras, poses, sequences, alerts) and storage cleanup
Maintainer thường phản hồi trong vòng 7 ngày
@Majyles đang làm issue này rồi.
Từ ngày 9/11/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Xem xét PR #538 và quy trình xóa organization xoay quanh organizations.session, bao gồm cả việc xóa liên kết alert được hiển thị trong issue. Theo dõi mối quan hệ giữa camera, pose, sequence, detection và media S3 liên quan với organization và các ràng buộc foreign-key của nó. Hoàn tất có nghĩa là việc xóa organization sẽ xóa tất cả các bản ghi và media được liệt kê mà không để lại dữ liệu mồ côi, đồng thời hoàn thành coverage test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Deleting an organization currently only removes alerts in order to satisfy foreign key constraints. Cameras, poses, sequences, detections, and associated media stored in S3 are not deleted. This leaves orphaned data and makes the data lifecycle unclear.
Before alerts were handled, deletion was already incomplete for cameras and related objects, so this issue existed even earlier and is not specific to alerts only.
I started addressing this partially in PR #538 by explicitly deleting alerts and their association tables, but coverage test became quite comple so I stopped for this PR and opened this issue to address it properly later
# Remove alerts and their associations for this organization to satisfy FK constraints
org_session = organizations.session
alert_ids_res = await org_session.exec(
select(Alert.id).where(Alert.organization_id == organization_id)
)
alert_ids = list(alert_ids_res.all())
if alert_ids:
delete_links = delete(AlertSequence).where(
cast(Any, AlertSequence.alert_id).in_(alert_ids)
)
delete_alerts = delete(Alert).where(
cast(Any, Alert.id).in_(alert_ids)
)
await org_session.exec(delete_links)
await org_session.exec(delete_alerts)
await org_session.commit()
- Ngôn ngữ chính
- Python
- Star
- 31
- Fork
- 15
- Merge trung bình
- 7 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pyronear/pyro-api
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 7 ngày
-
endpoint: detections type: fix
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của pyronear/pyro-api
Issue tương tự
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
jxxghp/MoviePilot#7576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
jbaruch/software-factory#266 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày