Refactor and extend puck handling with tell_position updates

Refactored puck updating logic to use Pydantic models for validation and normalization. Added a new endpoint to retrieve all pucks with a tell_position and their associated samples. Updated project version to 0.1.0a11 in pyproject.toml.
This commit is contained in:
GotthardG
2025-01-08 14:11:34 +01:00
parent 6d67d02259
commit 4f73f41717
3 changed files with 185 additions and 88 deletions

View File

@ -613,7 +613,7 @@ class SlotSchema(BaseModel):
class SetTellPosition(BaseModel):
puckname: str # The puck name is required.
puck_name: str
segment: Optional[str] = Field(
None,
pattern="^[A-F]$", # Valid segments are A, B, C, D, E, F
@ -637,3 +637,15 @@ class SetTellPosition(BaseModel):
if self.segment and self.puck_in_segment:
return f"{self.segment}{self.puck_in_segment}"
return None
class PuckWithTellPosition(BaseModel):
id: int
puck_name: str
puck_type: str
puck_location_in_dewar: Optional[str]
dewar_id: int
samples: List[Sample]
class Config:
from_attributes = True