diff --git a/backend/app/routers/puck.py b/backend/app/routers/puck.py index 3801178..145171d 100644 --- a/backend/app/routers/puck.py +++ b/backend/app/routers/puck.py @@ -338,6 +338,7 @@ async def get_pucks_by_slot(slot_identifier: str, db: Session = Depends(get_db)) ) dewar_ids = [dewar.id for dewar in dewars] + dewar_map = {dewar.id: dewar.dewar_name for dewar in dewars} # Subquery to fetch the latest tell_position for each puck subquery = ( @@ -380,6 +381,8 @@ async def get_pucks_by_slot(slot_identifier: str, db: Session = Depends(get_db)) f" Tell Position: {tell_position}" ) + dewar_name = dewar_map.get(puck.dewar_id, "Unknown") + # Prepare the PuckWithTellPosition instance results.append( PuckWithTellPosition( @@ -390,6 +393,7 @@ async def get_pucks_by_slot(slot_identifier: str, db: Session = Depends(get_db)) if puck.puck_location_in_dewar else None, dewar_id=puck.dewar_id, + dewar_name=dewar_name, tell_position=tell_position, # Latest tell_position from subquery ) ) diff --git a/backend/app/schemas.py b/backend/app/schemas.py index fd2d88e..e1f6245 100644 --- a/backend/app/schemas.py +++ b/backend/app/schemas.py @@ -478,7 +478,7 @@ class Puck(BaseModel): puck_location_in_dewar: int dewar_id: int events: List[PuckEvent] = [] - samples: List[Sample] = [] # List of samples within this puck + samples: List[Sample] = [] class Config: from_attributes = True @@ -645,6 +645,8 @@ class PuckWithTellPosition(BaseModel): puck_type: str puck_location_in_dewar: Optional[str] dewar_id: int + dewar_name: str + user: str = "e16371" samples: Optional[List[Sample]] = None tell_position: Optional[str] diff --git a/pyproject.toml b/pyproject.toml index 850cb35..e86be9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "aareDB" -version = "0.1.0a13" +version = "0.1.0a14" description = "Backend for next gen sample management system" authors = [{name = "Guillaume Gotthard", email = "guillaume.gotthard@psi.ch"}] license = {text = "MIT"}