Add endpoint for creating local contacts with access control
Introduced a new `local_contact_router` to handle creation of local contacts. The endpoint enforces role-based access control and ensures no duplication of email addresses. Updated the router exports for consistency and cleaned up a large test file to improve readability.
This commit is contained in:
@ -351,7 +351,7 @@ async def get_all_dewars(db: Session = Depends(get_db)):
|
||||
|
||||
@router.get("/dewar/table", response_model=List[DewarTable])
|
||||
async def get_all_dewars_table(db: Session = Depends(get_db)):
|
||||
dewars = db.query(DewarModel).all()
|
||||
dewars = db.query(DewarModel).filter(DewarModel.events.any()).all()
|
||||
|
||||
# Flatten relationships for simplified frontend rendering
|
||||
response = []
|
||||
@ -365,6 +365,7 @@ async def get_all_dewars_table(db: Session = Depends(get_db)):
|
||||
dewar_name=dewar.dewar_name,
|
||||
shipment_name=dewar.shipment.shipment_name if dewar.shipment else "N/A",
|
||||
# Use the most recent event if available
|
||||
beamtime=dewar.beamtime,
|
||||
status=dewar.events[-1].event_type if dewar.events else "No Events",
|
||||
tracking_number=dewar.tracking_number or "N/A",
|
||||
slot_id=dewar.slot[0].id
|
||||
|
Reference in New Issue
Block a user