feat/dynamic-catalog-pricing-api #50
|
|
@ -102,6 +102,38 @@ class ModuleBuilderService:
|
|||
) -> dict[str, Any]:
|
||||
await self._verify_module_editable(module_code)
|
||||
result = await self.compiler.sync_to_content_repo(module_code, repo_root=repo_root)
|
||||
|
||||
target_dir = result.get("target_dir")
|
||||
if target_dir:
|
||||
from pathlib import Path
|
||||
from app.bootstrap.seed_content.orchestrator import SeedOrchestrator
|
||||
|
||||
modules_root = Path(target_dir).parent
|
||||
config_path = modules_root / "config.json"
|
||||
if config_path.exists():
|
||||
from sqlalchemy import text
|
||||
from app.bootstrap.seed_content.schema import CONTENT_SCHEMA, resolve_content_schema
|
||||
|
||||
content_schema = resolve_content_schema(CONTENT_SCHEMA)
|
||||
await self.session.execute(
|
||||
text(
|
||||
f"UPDATE {content_schema}.content_items "
|
||||
"SET status = 'draft' "
|
||||
"WHERE source_key LIKE :prefix AND status = 'published'"
|
||||
),
|
||||
{"prefix": f"{module_code.strip().lower()}_%"},
|
||||
)
|
||||
if self.session.in_transaction():
|
||||
await self.session.commit()
|
||||
summaries = await SeedOrchestrator(self.session).process_config(
|
||||
config_path=config_path,
|
||||
modules_root=modules_root,
|
||||
module_codes={module_code.strip().lower()},
|
||||
publish_content=True,
|
||||
skip_search_facets=True,
|
||||
)
|
||||
result["db_synced"] = bool(summaries)
|
||||
|
||||
from .plan_service import AdminPlanService
|
||||
|
||||
pending_plan_code = await AdminPlanService(self.session).ensure_pending_pricing_plan_for_module(module_code)
|
||||
|
|
|
|||
|
|
@ -362,7 +362,6 @@ class ModuleContentCompiler:
|
|||
master_detail_items.append({
|
||||
"code": source_code,
|
||||
"slug": f"{module_code}-ct0005-{source_code}",
|
||||
"name": pat.name,
|
||||
"title": f"{dis.name} - {pat.name}",
|
||||
"pattern_name": pat.name,
|
||||
"pattern_number": p_idx + 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue