event list token updated
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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"},)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user