event list token updated

This commit is contained in:
2024-12-07 16:18:11 +03:00
parent 9e955841c3
commit 6ba0e37ffd
13 changed files with 243 additions and 213 deletions

View File

@@ -569,7 +569,6 @@ class BuildLivingSpace(CrudCollection):
status_code=status.HTTP_418_IM_A_TEAPOT,
detail="Service is not found in database. Re-enter service record then try again.",
)
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,
)

View File

@@ -106,6 +106,24 @@ class Services(CrudCollection):
)
related_responsibility: Mapped[str] = mapped_column(String, server_default="")
@classmethod
def retrieve_service_via_occupant_code(cls, occupant_code):
from databases import OccupantTypes
occupant_type = OccupantTypes.filter_by_one(
system=True,
occupant_code=occupant_code,
).data
if not occupant_type:
cls.raise_http_exception(
status_code="HTTP_404_NOT_FOUND",
error_case="RECORD_NOT_FOUND",
message=f"No occupant type found for this code : {occupant_code}",
data={
"occupant_code": occupant_code,
},
)
return cls.filter_one(cls.related_responsibility == occupant_type.occupant_code).data
__table_args__ = ({"comment": "Services Information"},)