auth updated availaible event
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -216,7 +216,10 @@ class Event2Employee(CrudCollection):
|
||||
cls.employee_id == employee_id,
|
||||
).data
|
||||
active_events = Service2Events.filter_all(
|
||||
Service2Events.service_id.in_([event.event_service_id for event in occupant_events]), system=True
|
||||
Service2Events.service_id.in_(
|
||||
[event.event_service_id for event in occupant_events]
|
||||
),
|
||||
system=True,
|
||||
).data
|
||||
active_events_id = [event.event_id for event in active_events]
|
||||
if extra_events := Event2EmployeeExtra.filter_all(
|
||||
@@ -265,7 +268,10 @@ class Event2Occupant(CrudCollection):
|
||||
cls.build_living_space_id == build_living_space_id,
|
||||
).data
|
||||
active_events = Service2Events.filter_all(
|
||||
Service2Events.service_id.in_([event.event_service_id for event in occupant_events]), system=True
|
||||
Service2Events.service_id.in_(
|
||||
[event.event_service_id for event in occupant_events]
|
||||
),
|
||||
system=True,
|
||||
).data
|
||||
active_events_id = [event.event_id for event in active_events]
|
||||
if extra_events := Event2OccupantExtra.filter_all(
|
||||
|
||||
Reference in New Issue
Block a user