events updated

This commit is contained in:
2024-12-29 19:16:26 +03:00
parent 5223f36da7
commit 7997e561f7
12 changed files with 250 additions and 31 deletions

View File

@@ -143,10 +143,11 @@ from api_events.events.decision_book.project_decision_book_items import (
BuildDecisionBookProjectItemsCreateEventMethod,
BuildDecisionBookProjectItemsListEventMethod,
)
from a_project_files.later_use_codes.events_bind_events import (
EventBindOccupantEventMethod,
EventBindEmployeeEventMethod,
)
# from api_events.events.events.events_ import (
# EventBindOccupantEventMethod,
# EventBindEmployeeEventMethod,
# )
from api_events.events.events.events_bind_services import (
ServiceBindOccupantEventMethod,
ServiceBindEmployeeEventMethod,
@@ -275,8 +276,8 @@ __all__ = [
"StaffGetByUUIDEventMethod",
"StaffUpdateEventMethod",
"StaffPatchEventMethod",
"EventBindOccupantEventMethod",
"EventBindEmployeeEventMethod",
# "EventBindOccupantEventMethod",
# "EventBindEmployeeEventMethod",
"ServiceBindOccupantEventMethod",
"ServiceBindEmployeeEventMethod",
"BuildDecisionBookInvitationsListEventMethod",

View File

@@ -270,7 +270,6 @@ class AuthenticationSelectEventMethods(MethodToEvent):
)
class AuthenticationCheckTokenEventMethods(MethodToEvent):
event_type = "LOGIN"
@@ -286,8 +285,8 @@ class AuthenticationCheckTokenEventMethods(MethodToEvent):
@classmethod
def authentication_check_token_is_valid(
cls,
request,
cls,
request,
):
if get_object_via_access_key(request=request):
return JSONResponse(
@@ -712,9 +711,9 @@ class AuthenticationDownloadAvatarEventMethods(MethodToEvent):
}
@classmethod
def authentication_download_avatar(cls, token_dict: Union[
EmployeeTokenObject, OccupantTokenObject
]):
def authentication_download_avatar(
cls, token_dict: Union[EmployeeTokenObject, OccupantTokenObject]
):
if found_user := Users.filter_one(Users.id == token_dict.user_id).data:
expired_starts = str(
system_arrow.now() - system_arrow.get(str(found_user.expiry_ends))
@@ -728,6 +727,7 @@ class AuthenticationDownloadAvatarEventMethods(MethodToEvent):
"completed": True,
"message": "Avatar and profile is shared via user credentials",
"data": {
"lang": token_dict.lang,
"full_name": found_user.person.full_name,
"avatar": found_user.avatar,
"remember_me": found_user.remember_me,

View File

@@ -3,6 +3,7 @@ from typing import Union
from fastapi.responses import JSONResponse
from fastapi import status
from api_validations.validations_response.parts import BuildPartsListResponse
from databases import (
Build,
BuildParts,
@@ -24,7 +25,7 @@ class BuildingBuildPartsListEventMethods(MethodToEvent):
__event_keys__ = {
"b860e37a-e19b-4c45-9543-461241f7587c": "building_build_parts_list"
}
__event_validation__ = {"b860e37a-e19b-4c45-9543-461241f7587c": None}
__event_validation__ = {"b860e37a-e19b-4c45-9543-461241f7587c": BuildPartsListResponse}
@classmethod
def building_build_parts_list(
@@ -45,6 +46,9 @@ class BuildingBuildPartsListEventMethods(MethodToEvent):
completed=True,
message="Building Parts Records are listed",
result=records,
cls_object=BuildParts,
response_model=BuildPartsListResponse,
filter_attributes=list_options,
)

View File

@@ -20,16 +20,21 @@ from api_validations.validations_request import (
UpdateBuildLivingSpace,
ListOptions,
)
from api_validations.validations_response.living_space import LivingSpaceListResponse
from databases.sql_models.event.event import Services
class BuildingLivingSpacesListEventMethods(MethodToEvent):
event_type = "SELECT"
event_description = ""
event_category = ""
__event_keys__ = {
"36961d8a-cefa-46cc-9f7c-9d841d6351b6": "building_live_space_list",
}
__event_validation__ = {"36961d8a-cefa-46cc-9f7c-9d841d6351b6": None}
__event_validation__ = {
"36961d8a-cefa-46cc-9f7c-9d841d6351b6": LivingSpaceListResponse
}
@classmethod
def building_live_space_list(
@@ -100,6 +105,9 @@ class BuildingLivingSpacesListEventMethods(MethodToEvent):
completed=True,
message="Building Living Spaces are listed successfully",
result=records,
response_model=LivingSpaceListResponse,
cls_object=BuildLivingSpace,
filter_attributes=list_options,
)

View File

@@ -38,7 +38,9 @@ class DecisionBookPersonListEventMethods(MethodToEvent):
@classmethod
def building_decision_book_person_list(
cls, data: ListOptions, token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
cls,
data: ListOptions,
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
):
return

View File

@@ -3,6 +3,7 @@ from typing import Union
from fastapi import status
from fastapi.responses import JSONResponse
from api_validations.validations_response.people import PeopleListResponse
from databases import (
Build,
People,
@@ -26,7 +27,7 @@ class PeopleListEventMethods(MethodToEvent):
"cdf62f06-ec50-40de-b19e-adb3dd34bb95": "people_list_only_occupant_tenant_or_owner",
}
__event_validation__ = {
"0a05f03c-6ed8-4230-a4ff-6e7cf886909b": None,
"0a05f03c-6ed8-4230-a4ff-6e7cf886909b": PeopleListResponse,
"b5612538-0445-4a4a-ab13-d2a06037f7a5": None,
"25cbbaf8-117a-470f-a844-2cfc70f71dde": None,
"cdf62f06-ec50-40de-b19e-adb3dd34bb95": None,
@@ -60,6 +61,9 @@ class PeopleListEventMethods(MethodToEvent):
completed=True,
message="People are listed successfully",
result=records,
cls_object=People,
filter_attributes=list_options,
response_model=PeopleListResponse,
)
@classmethod