feat: Add MediaWiki import functionality with tracking and mapping
- Implemented a new SQL migration for wiki import tracking tables. - Created an import router for handling MediaWiki imports of exercises, skills, and methods. - Developed a Semantic MediaWiki API client for direct API interactions. - Added a mapper to convert SMW properties to local database fields. - Introduced background tasks for asynchronous import processing. - Implemented logging and error handling for import operations. - Added endpoints for previewing imports, checking import status, and managing import references.
This commit is contained in:
1 parent
0e0b709768
commit
6801c60604
19 files changed
+9472
-5
No files matched your search
@@ -0,0 +1,40 @@
|
||||
-- Migration 018: MediaWiki Import Tracking Tables
|
||||
-- Tracks import runs and cross-references between Wiki pages and local DB entries
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wiki_import_log (
|
||||
id SERIAL PRIMARY KEY,
|
||||
import_type VARCHAR(50) NOT NULL
|
||||
CHECK (import_type IN ('exercise', 'skill', 'method', 'maturity_model')),
|
||||
import_status VARCHAR(20) NOT NULL DEFAULT 'running'
|
||||
CHECK (import_status IN ('running', 'completed', 'failed')),
|
||||
category VARCHAR(200), -- Wiki category name used
|
||||
dry_run BOOLEAN DEFAULT false,
|
||||
reimport BOOLEAN DEFAULT false,
|
||||
items_total INT DEFAULT 0,
|
||||
items_imported INT DEFAULT 0,
|
||||
items_skipped INT DEFAULT 0,
|
||||
items_failed INT DEFAULT 0,
|
||||
error_log JSONB DEFAULT '[]'::jsonb, -- [{item, error}, ...]
|
||||
imported_by INT REFERENCES profiles(id),
|
||||
started_at TIMESTAMP DEFAULT NOW(),
|
||||
finished_at TIMESTAMP,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wiki_import_references (
|
||||
id SERIAL PRIMARY KEY,
|
||||
wiki_page_title VARCHAR(500) NOT NULL,
|
||||
wiki_page_id INT, -- MediaWiki internal page ID
|
||||
content_type VARCHAR(50) NOT NULL
|
||||
CHECK (content_type IN ('exercise', 'skill', 'method', 'maturity_model')),
|
||||
local_id INT NOT NULL, -- ID in the local DB table
|
||||
last_imported TIMESTAMP DEFAULT NOW(),
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
UNIQUE(wiki_page_title, content_type)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_wiki_refs_title ON wiki_import_references(wiki_page_title);
|
||||
CREATE INDEX IF NOT EXISTS idx_wiki_refs_type ON wiki_import_references(content_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_wiki_log_status ON wiki_import_log(import_status);
|
||||
CREATE INDEX IF NOT EXISTS idx_wiki_log_type ON wiki_import_log(import_type);
|
||||
Reference in new issue
Block a user