Add endpoints and logic for fetching associations by beamtime
Introduced endpoints to fetch pucks, dewars, and samples by beamtime ID. Updated backend logic to ensure consistency between dewars, pucks, and samples assignments. Enhanced frontend to display and handle beamline-specific associations dynamically.
This commit is contained in:
@ -718,3 +718,13 @@ async def get_single_shipment(id: int, db: Session = Depends(get_db)):
|
||||
except SQLAlchemyError as e:
|
||||
logging.error(f"Database error occurred: {e}")
|
||||
raise HTTPException(status_code=500, detail="Internal server error")
|
||||
|
||||
|
||||
@dewar_router.get(
|
||||
"/by-beamtime/{beamtime_id}",
|
||||
response_model=List[DewarSchema],
|
||||
operation_id="get_dewars_by_beamtime",
|
||||
)
|
||||
async def get_dewars_by_beamtime(beamtime_id: int, db: Session = Depends(get_db)):
|
||||
"""List all dewars assigned to a given beamtime."""
|
||||
return db.query(DewarModel).filter(DewarModel.beamtime_id == beamtime_id).all()
|
||||
|
Reference in New Issue
Block a user