get puck events
This commit is contained in:
parent
9cd0d81dac
commit
ed84060563
@ -126,4 +126,18 @@ async def get_last_tell_position(puck_id: str, db: Session = Depends(get_db)):
|
||||
"puck_id": puck_id,
|
||||
"tell_position": last_event.tell_position,
|
||||
"timestamp": last_event.timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
@router.get("/pucks/slot/{slot_id}", response_model=List[PuckSchema])
|
||||
async def get_pucks_by_slot(slot_id: int, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Retrieve all pucks for a given slot_id
|
||||
"""
|
||||
# Query for the pucks associated with the slot_id
|
||||
pucks = db.query(PuckModel).filter(PuckModel.puck_location_in_dewar == slot_id).all()
|
||||
|
||||
# If no pucks found, return an empty list
|
||||
if not pucks:
|
||||
return []
|
||||
|
||||
return pucks
|
Loading…
x
Reference in New Issue
Block a user