feat: add target_lists table, schema, and CRUD endpoints

Introduces the TargetList model (team-scoped JSONB target arrays),
Pydantic schemas, and full CRUD REST API at /target-lists/.
Includes Alembic migration and 5 integration tests (TDD).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-02-17 11:16:40 -05:00
parent 36e1335a00
commit 0c2d4ba685
7 changed files with 686 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
from datetime import datetime
from typing import Optional
from uuid import UUID
from pydantic import BaseModel, Field
class TargetEntry(BaseModel):
label: str = Field(..., min_length=1, max_length=255)
notes: Optional[str] = Field(None, max_length=500)
class TargetListCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=255)
description: Optional[str] = None
targets: list[TargetEntry] = Field(..., min_length=1)
class TargetListUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=255)
description: Optional[str] = None
targets: Optional[list[TargetEntry]] = None
class TargetListResponse(BaseModel):
id: UUID
team_id: UUID
created_by: Optional[UUID]
name: str
description: Optional[str]
targets: list[TargetEntry]
created_at: datetime
updated_at: datetime
model_config = {"from_attributes": True}