Revert "[verified] feat: add external calendar subscriptions"
ci / gitleaks (push) Successful in 9s
ci / docker (push) Failing after 11m21s

This reverts commit 583b6a8a9d.
This commit is contained in:
2026-09-20 13:57:35 +08:00
parent 6528cbbb1e
commit 2715b74f2e
11 changed files with 2 additions and 849 deletions
+1 -15
View File
@@ -19,7 +19,6 @@ from backend.models import (
BackupImport,
BackupImportEntity,
BackupPreflight,
CalendarSubscription,
Countdown,
Folder,
Habit,
@@ -66,7 +65,6 @@ ENTITY_MODELS = {
"habit_pauses": HabitPause,
"countdowns": Countdown,
"memos": Memo,
"calendar_subscriptions": CalendarSubscription,
"attachments": Attachment,
}
RELATIONS = {
@@ -394,9 +392,6 @@ def _validate_recurrence_graph(parsed: ParsedArchive) -> None:
def validate_archive(parsed: ParsedArchive) -> None:
unknown = set(parsed.entities) - set(ENTITY_MODELS)
# Calendar subscriptions were introduced after backup v2. Treat their
# absence as an empty collection so archives from older Dodo releases remain restorable.
parsed.entities.setdefault("calendar_subscriptions", [])
missing = set(ENTITY_MODELS) - set(parsed.entities)
if unknown:
raise backup_error("backup_entity_unknown", "备份包含未知实体")
@@ -616,16 +611,7 @@ async def restore_v2(
await db.execute(delete(HabitPause).where(
HabitPause.habit_id.in_(select(Habit.id).where(Habit.user_id == user.id))
))
for model in (
Attachment,
CalendarSubscription,
Memo,
Countdown,
Task,
Habit,
TaskList,
Folder,
):
for model in (Attachment, Memo, Countdown, Task, Habit, TaskList, Folder):
await db.execute(delete(model).where(model.user_id == user.id))
await db.execute(delete(BackupImportEntity).where(BackupImportEntity.user_id == user.id))
await db.execute(delete(BackupImport).where(BackupImport.user_id == user.id))