auth updated availaible event
This commit is contained in:
@@ -126,7 +126,7 @@ class AuthModule(PasswordModule):
|
||||
except Exception as e:
|
||||
err = e
|
||||
token_is_expired = system_arrow.now() >= system_arrow.get(
|
||||
found_user.password_expiry_begins
|
||||
str(found_user.password_expiry_begins)
|
||||
).shift(days=replace_day)
|
||||
|
||||
if not password_token == found_user.password_token and token_is_expired:
|
||||
@@ -157,7 +157,8 @@ class AuthModule(PasswordModule):
|
||||
found_user.hash_password = new_password_dict.get("password")
|
||||
found_user.password_token = "" if found_user.password_token else ""
|
||||
query_engine.refresh_password_history_via_user(payload=history_dict)
|
||||
return found_user.save()
|
||||
found_user.save()
|
||||
return found_user
|
||||
|
||||
@staticmethod
|
||||
def reset_password_token(found_user):
|
||||
@@ -241,7 +242,6 @@ class UserLoginModule(AuthModule):
|
||||
found_user.last_platform = headers_request.get("evyos-platform", None)
|
||||
found_user.last_remote_addr = headers_request.get("evyos-ip-ext", None)
|
||||
found_user.last_seen = str(system_arrow.now())
|
||||
|
||||
if ext_ip := headers_request.get("evyos-ip-ext"):
|
||||
agent = headers_request.get("evyos-user-agent", "")
|
||||
platform = headers_request.get("evyos-platform", "")
|
||||
|
||||
@@ -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