Refactor Dewar service methods and improve field handling

Updated Dewar API methods to use protected endpoints for enhanced security and consistency. Added `pgroups` handling in various frontend components and modified the LogisticsView contact field for clarity. Simplified backend router imports for better readability.
This commit is contained in:
GotthardG 2025-01-30 15:25:04 +01:00
parent ee97bdfb5d
commit 3757950b51

View File

@ -298,17 +298,17 @@ def generate_label(dewar):
c.drawString(2 * cm, y_position, f"Unique ID: {dewar.unique_id}")
y_position -= line_height
if dewar.contact_person:
contact_person = dewar.contact_person
if dewar.contact:
contact = dewar.contact
c.drawString(
2 * cm,
y_position,
f"Contact: {contact_person.firstname} {contact_person.lastname}",
f"Contact: {contact.firstname} {contact.lastname}",
)
y_position -= line_height
c.drawString(2 * cm, y_position, f"Email: {contact_person.email}")
c.drawString(2 * cm, y_position, f"Email: {contact.email}")
y_position -= line_height
c.drawString(2 * cm, y_position, f"Phone: {contact_person.phone_number}")
c.drawString(2 * cm, y_position, f"Phone: {contact.phone_number}")
y_position -= line_height
if dewar.return_address:
@ -368,7 +368,7 @@ async def download_dewar_label(dewar_id: int, db: Session = Depends(get_db)):
db.query(DewarModel)
.options(
joinedload(DewarModel.pucks).joinedload(PuckModel.samples),
joinedload(DewarModel.contact_person),
joinedload(DewarModel.contact),
joinedload(DewarModel.return_address),
joinedload(DewarModel.shipment),
)