feat(orion): extend report layout settings to version 1.1

This commit is contained in:
Schubert Ferenc 2026-07-12 14:56:15 +02:00
parent 12e1761a5b
commit 613ffdc8b7
591 changed files with 3601 additions and 999 deletions

View file

@ -61,6 +61,8 @@ class QuickStartService:
device = self._device(str(payload.device_id)) if payload.device_id else self._single_or_default(devices)
if device is None:
raise ValueError("Kein Gerät verfügbar.")
if device.customer_id != customer.id:
raise ValueError("Gerät gehört nicht zum ausgewählten Kunden.")
locations = list(
self.session.scalars(
select(Location).where(Location.customer_id == customer.id).order_by(Location.name.asc())
@ -73,13 +75,23 @@ class QuickStartService:
)
location = self._location(str(payload.location_id)) if payload.location_id else self._single_or_default(locations)
contact = self._contact(str(payload.contact_id)) if payload.contact_id else self._single_or_default(contacts)
if location is None:
if locations:
raise ValueError("Bitte Standort auswählen.")
raise ValueError("Kein Standort verfügbar.")
if location.customer_id != customer.id:
raise ValueError("Standort gehört nicht zum ausgewählten Kunden.")
if device.location_id and device.location_id != location.id:
raise ValueError("Gerät gehört nicht zum gewählten Standort.")
if contact and contact.customer_id != customer.id:
raise ValueError("Ansprechpartner gehört nicht zum ausgewählten Kunden.")
base = self._base_validation(device.id, payload.validation_type)
bundle = ReportTemplateService(self.session).ensure_default_template()
validation = Validation(
report_number=self._next_report_number(),
customer_id=customer.id,
location_id=location.id if location else (locations[0].id if locations else None),
location_id=location.id,
contact_id=contact.id if contact else None,
device_id=device.id,
validation_type=payload.validation_type,