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:
GotthardG
2025-02-26 09:58:19 +01:00
parent 43d67b1044
commit f588bc0cda
13 changed files with 360 additions and 418 deletions

View File

@ -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