fix: reimport dict-cursor bug + add admin cleanup endpoint
Problem 1: Reimport fails completely (all exercises fail) Root cause: Line 465 existing[0] instead of existing['id'] Fix: Changed to existing['id'] for dict-cursor compatibility Problem 2: 221 exercises skipped, only 2 in database Root cause: Orphaned wiki_import_references from failed imports Fix: New admin endpoint to manually cleanup orphaned references New endpoints: - DELETE /api/import/mediawiki/admin/cleanup-orphaned-references Deletes all references where local_id doesn't exist in target table Returns count of deleted references per type - GET /api/import/mediawiki/admin/stats Shows references vs. actual count + orphaned count Helps diagnose import state issues Usage: 1. Call cleanup endpoint to remove orphaned references 2. Run normal import (reimport=false) 3. Should import all previously failed exercises
This commit is contained in:
1 parent
3a4160fd1c
commit
97a7fe7cba
3 files changed
+98
-2
No files matched your search
+2
-1
@@ -70,7 +70,7 @@ def read_root():
|
||||
}
|
||||
|
||||
# Register routers
|
||||
from routers import auth, profiles, exercises, clubs, skills, training_planning, catalogs, import_wiki
|
||||
from routers import auth, profiles, exercises, clubs, skills, training_planning, catalogs, import_wiki, import_wiki_admin
|
||||
|
||||
app.include_router(auth.router)
|
||||
app.include_router(profiles.router)
|
||||
@@ -80,6 +80,7 @@ app.include_router(skills.router)
|
||||
app.include_router(training_planning.router)
|
||||
app.include_router(catalogs.router)
|
||||
app.include_router(import_wiki.router)
|
||||
app.include_router(import_wiki_admin.router)
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
Reference in new issue
Block a user