Files
bakery-ia/shared/utils/seed_data_paths.py

46 lines
1.4 KiB
Python
Raw Normal View History

2025-12-13 23:57:54 +01:00
"""
Seed Data Path Utilities
Provides functions to locate seed data files for demo data creation
"""
from pathlib import Path
2025-12-17 13:03:52 +01:00
def get_seed_data_path(profile: str, filename: str, child_profile: str = None, child_id: str = None) -> Path:
2025-12-13 23:57:54 +01:00
"""
2025-12-17 13:03:52 +01:00
Get the path to a seed data file.
2025-12-13 23:57:54 +01:00
Args:
profile: Demo profile (professional/enterprise)
filename: Seed data filename
2025-12-17 13:03:52 +01:00
child_profile: Not used (kept for API compatibility)
child_id: Optional child tenant ID for enterprise child locations
2025-12-13 23:57:54 +01:00
Returns:
Path to the seed data file
2025-12-17 13:03:52 +01:00
2025-12-13 23:57:54 +01:00
Raises:
2025-12-17 13:03:52 +01:00
FileNotFoundError: If seed data file cannot be found
2025-12-13 23:57:54 +01:00
"""
2025-12-17 13:03:52 +01:00
base_path = Path(__file__).parent.parent / "demo" / "fixtures"
if child_id:
# Enterprise child location: enterprise/children/{child_id}/{filename}
file_path = base_path / profile / "children" / child_id / filename
elif profile == "enterprise":
# Enterprise parent: enterprise/parent/{filename}
file_path = base_path / profile / "parent" / filename
2025-12-13 23:57:54 +01:00
else:
2025-12-17 13:03:52 +01:00
# Professional: professional/{filename}
file_path = base_path / profile / filename
2025-12-13 23:57:54 +01:00
2025-12-17 13:03:52 +01:00
if not file_path.exists():
raise FileNotFoundError(
f"Seed data file not found: {file_path}\n"
f"Profile: {profile}\n"
f"Child ID: {child_id}\n"
f"Filename: {filename}"
)
2025-12-13 23:57:54 +01:00
2025-12-17 13:03:52 +01:00
return file_path