endpoint_restriction_available updated

This commit is contained in:
berkay 2025-01-01 16:43:40 +03:00
parent 1c6fffd29d
commit 17a6609a8f
1 changed files with 5 additions and 3 deletions

View File

@ -76,6 +76,7 @@ def endpoint_restriction_available(request: Request, data: CheckEndpointAccess):
EndpointRestriction.endpoint_name.ilike(f"%{data.endpoint}%"), EndpointRestriction.endpoint_name.ilike(f"%{data.endpoint}%"),
system=True, system=True,
).data ).data
print("endpoint", endpoint)
if not endpoint: if not endpoint:
EndpointRestriction.raise_http_exception( EndpointRestriction.raise_http_exception(
status_code="HTTP_404_NOT_FOUND", status_code="HTTP_404_NOT_FOUND",
@ -84,9 +85,9 @@ def endpoint_restriction_available(request: Request, data: CheckEndpointAccess):
data={}, data={},
) )
event = Events.filter_one(Events.endpoint_id == endpoint.id).data event = Events.filter_one(Events.endpoint_id == endpoint.id).data
service = Service2Events.filter_one( print("event", event)
Service2Events.event_id == event.id, service = Service2Events.filter_one(Service2Events.event_id == event.id).data
).data print("service", service)
if isinstance(token_dict, OccupantTokenObject): if isinstance(token_dict, OccupantTokenObject):
event_occupant = Event2Occupant.filter_one( event_occupant = Event2Occupant.filter_one(
Event2Occupant.event_service_id == service.id, Event2Occupant.event_service_id == service.id,
@ -109,6 +110,7 @@ def endpoint_restriction_available(request: Request, data: CheckEndpointAccess):
Event2Employee.event_service_id == service.id, Event2Employee.event_service_id == service.id,
Event2Employee.employee_id == token_dict.selected_company.employee_id, Event2Employee.employee_id == token_dict.selected_company.employee_id,
).data ).data
print("event_employee", event_employee)
if not event_employee: if not event_employee:
EndpointRestriction.raise_http_exception( EndpointRestriction.raise_http_exception(
status_code="HTTP_404_NOT_FOUND", status_code="HTTP_404_NOT_FOUND",