auth updated availaible event

This commit is contained in:
2024-12-06 16:35:25 +03:00
parent 88309eb49d
commit 9e955841c3
9 changed files with 51 additions and 34 deletions

View File

@@ -551,9 +551,7 @@ class BuildLivingSpace(CrudCollection):
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
):
from databases import Services, OccupantTypes
from api_events.events.events.events_bind_services import (
ServiceBindOccupantEventMethods,
)
from api_events.events.events.events_bind_modules import ModulesBindOccupantEventMethods
if data.get("expiry_starts"):
data["expiry_starts"] = str(system_arrow.get(data["expiry_starts"]))
@@ -566,18 +564,16 @@ class BuildLivingSpace(CrudCollection):
related_service = Services.filter_by_one(
related_responsibility=occupant_type.occupant_code,
).data
created_living_space.save_and_confirm()
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,
print('created_living_space', created_living_space.get_dict())
ModulesBindOccupantEventMethods.bind_default_module_for_first_init_occupant(
build_living_space_id=created_living_space.id,
)
created_living_space.save_and_confirm()
return created_living_space
@classmethod