Scope training run queries in FastAPI to filter by user ID (Task 14.3)
- Add user_id column to TrainingRun model in db.py
- Store user_id on TrainingRun insert in /training/start
- Filter GET /training/runs by user_id (returns empty list if no user context)
- Enforce user ownership on GET /training/runs/{run_id} (404 on mismatch)
- Enforce user ownership on DELETE /training/runs/{run_id} (404 on mismatch)
- Add migration 002 to add user_id column and index to training_runs table
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cbb921b4a7
commit
688e75e6be
3 changed files with 36 additions and 5 deletions
|
|
@ -46,6 +46,7 @@ class TrainingRun(Base):
|
|||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
run_id = Column(String(255), unique=True, nullable=False, index=True)
|
||||
user_id = Column(String(255), nullable=True, index=True)
|
||||
model_type = Column(String(100), nullable=False)
|
||||
experiment_name = Column(String(255), nullable=False, index=True)
|
||||
pipeline_config_hash = Column(String(64), nullable=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue