Initial commit - production deployment
This commit is contained in:
45
shared/utils/seed_data_paths.py
Normal file
45
shared/utils/seed_data_paths.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Seed Data Path Utilities
|
||||
Provides functions to locate seed data files for demo data creation
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_seed_data_path(profile: str, filename: str, child_profile: str = None, child_id: str = None) -> Path:
|
||||
"""
|
||||
Get the path to a seed data file.
|
||||
|
||||
Args:
|
||||
profile: Demo profile (professional/enterprise)
|
||||
filename: Seed data filename
|
||||
child_profile: Not used (kept for API compatibility)
|
||||
child_id: Optional child tenant ID for enterprise child locations
|
||||
|
||||
Returns:
|
||||
Path to the seed data file
|
||||
|
||||
Raises:
|
||||
FileNotFoundError: If seed data file cannot be found
|
||||
"""
|
||||
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
|
||||
else:
|
||||
# Professional: professional/{filename}
|
||||
file_path = base_path / profile / filename
|
||||
|
||||
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}"
|
||||
)
|
||||
|
||||
return file_path
|
||||
Reference in New Issue
Block a user