events imports are checked

This commit is contained in:
2024-11-08 15:05:12 +03:00
parent 643d6d8f65
commit a5b1e0b2f4
71 changed files with 2517 additions and 312 deletions

View File

@@ -587,27 +587,26 @@ class BuildLivingSpace(CrudCollection):
data: dict,
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
):
from database_sql_models import Services, OccupantTypes
from events.events_bind_services import ServiceBindOccupantEventMethods
from databases import Services, OccupantTypes
from api_events.events.events.events_bind_services import ServiceBindOccupantEventMethods
created_living_space = BuildLivingSpace.find_or_create(**data)
if not created_living_space.is_found:
occupant_type = OccupantTypes.find_one(
uu_id=created_living_space.occupant_type_uu_id
)
related_service = Services.find_one(
active=True,
related_responsibility=occupant_type.occupant_code,
)
if not related_service:
raise HTTPException(
status_code=status.HTTP_418_IM_A_TEAPOT,
detail="Service is not found in database. Re-enter service record then try again.",
)
ServiceBindOccupantEventMethods.bind_services_occupant_system(
service_id=related_service.id,
build_living_space_id=created_living_space.id,
occupant_type = OccupantTypes.find_one(
uu_id=created_living_space.occupant_type_uu_id
)
related_service = Services.find_one(
active=True,
related_responsibility=occupant_type.occupant_code,
)
if not related_service:
raise HTTPException(
status_code=status.HTTP_418_IM_A_TEAPOT,
detail="Service is not found in database. Re-enter service record then try again.",
)
ServiceBindOccupantEventMethods.bind_services_occupant_system(
service_id=related_service.id,
build_living_space_id=created_living_space.id,
)
return created_living_space
@classmethod

View File

@@ -426,7 +426,7 @@ class BuildDecisionBookPerson(CrudCollection):
build_living_space_id=related_living_space.id,
service_id=related_service.id,
expires_at=str(
DateTimeLocal.get(str(decision_book.meeting_date)).shift(
DateTimeLocal.get(decision_book.meeting_date).shift(
days=15
)
),