feat: Add catalog generation functionality and related models
- Implemented CatalogResource for handling catalog generation requests and status checks. - Created CatalogGenerationService to manage the asynchronous generation process. - Added models for catalog generation responses, requests, and structured catalog data. - Introduced utility scripts for database interaction and Kubernetes pod retrieval. - Enhanced error handling and logging throughout the catalog generation workflow.
This commit is contained in:
47
Scripts/DC_CATALOG_GEN_ALTER.sql
Normal file
47
Scripts/DC_CATALOG_GEN_ALTER.sql
Normal file
@@ -0,0 +1,47 @@
|
||||
-- =============================================================================
|
||||
-- DC_CATALOG_GEN_ALTER.sql
|
||||
-- Ergänzt dc_question_catalogs um Spalten für asynchrone Katalog-Generierung.
|
||||
-- Idempotent: Fehler "Spalte existiert bereits" wird ignoriert.
|
||||
-- =============================================================================
|
||||
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE '
|
||||
ALTER TABLE dc_question_catalogs ADD (
|
||||
generation_status VARCHAR2(20) DEFAULT ''READY'',
|
||||
generation_error VARCHAR2(4000)
|
||||
)
|
||||
';
|
||||
DBMS_OUTPUT.PUT_LINE('Spalten generation_status/generation_error angelegt.');
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
IF SQLCODE = -1430 THEN
|
||||
DBMS_OUTPUT.PUT_LINE('Spalten existieren bereits – kein Änderungsbedarf.');
|
||||
ELSE
|
||||
RAISE;
|
||||
END IF;
|
||||
END;
|
||||
/
|
||||
|
||||
-- Bestehende Zeilen bekommen Status READY (Kataloge wurden manuell erstellt)
|
||||
UPDATE dc_question_catalogs
|
||||
SET generation_status = 'READY'
|
||||
WHERE generation_status IS NULL;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Constraint nachträglich hinzufügen (idempotent)
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE '
|
||||
ALTER TABLE dc_question_catalogs
|
||||
ADD CONSTRAINT chk_cat_gen_status
|
||||
CHECK (generation_status IN (''GENERATING'', ''READY'', ''ERROR''))
|
||||
';
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
IF SQLCODE IN (-2264, -2261) THEN NULL; -- Constraint existiert bereits
|
||||
ELSE RAISE;
|
||||
END IF;
|
||||
END;
|
||||
/
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user