event list token updated
This commit is contained in:
parent
9e955841c3
commit
6ba0e37ffd
|
|
@ -107,9 +107,9 @@ from api_events.events.company.company_staff import (
|
||||||
StaffPatchEventMethod,
|
StaffPatchEventMethod,
|
||||||
)
|
)
|
||||||
from api_events.events.building.building_living_spaces import (
|
from api_events.events.building.building_living_spaces import (
|
||||||
BuildingLivingSpacesPartsListEventMethod,
|
BuildingLivingSpacesListEventMethod,
|
||||||
BuildingLivingSpacesPartsCreateEventMethod,
|
BuildingLivingSpacesCreateEventMethod,
|
||||||
BuildingLivingSpacesPartsUpdateEventMethod,
|
BuildingLivingSpacesUpdateEventMethod,
|
||||||
)
|
)
|
||||||
from api_events.events.decision_book.decision_book_decision_book import (
|
from api_events.events.decision_book.decision_book_decision_book import (
|
||||||
DecisionBookListEventMethod,
|
DecisionBookListEventMethod,
|
||||||
|
|
@ -211,9 +211,9 @@ __all__ = [
|
||||||
"BuildingBuildPartsCreateEventMethod",
|
"BuildingBuildPartsCreateEventMethod",
|
||||||
"BuildingBuildPartsUpdateEventMethod",
|
"BuildingBuildPartsUpdateEventMethod",
|
||||||
"BuildingBuildPartsPatchEventMethod",
|
"BuildingBuildPartsPatchEventMethod",
|
||||||
"BuildingLivingSpacesPartsListEventMethod",
|
"BuildingLivingSpacesListEventMethod",
|
||||||
"BuildingLivingSpacesPartsCreateEventMethod",
|
"BuildingLivingSpacesCreateEventMethod",
|
||||||
"BuildingLivingSpacesPartsUpdateEventMethod",
|
"BuildingLivingSpacesUpdateEventMethod",
|
||||||
"BuildAreaListEventMethod",
|
"BuildAreaListEventMethod",
|
||||||
"BuildAreaCreateEventMethod",
|
"BuildAreaCreateEventMethod",
|
||||||
"BuildAreaUpdateEventMethod",
|
"BuildAreaUpdateEventMethod",
|
||||||
|
|
|
||||||
|
|
@ -163,8 +163,8 @@ class AccountRecordsListEventMethods(MethodToEvent):
|
||||||
.filter(*main_filters)
|
.filter(*main_filters)
|
||||||
).order_by(order_by_list)
|
).order_by(order_by_list)
|
||||||
|
|
||||||
query.limit(list_options.page_size or 5).offset(
|
query.limit(list_options.size or 5).offset(
|
||||||
(list_options.page or 1 - 1) * list_options.page_size or 5
|
(list_options.page or 1 - 1) * list_options.size or 5
|
||||||
)
|
)
|
||||||
for list_of_values in query.all() or []:
|
for list_of_values in query.all() or []:
|
||||||
return_list.append(
|
return_list.append(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from api_events.events.events.events_bind_modules import ModulesBindOccupantEventMethods
|
|
||||||
|
from api_events.events.events.events_bind_services import (
|
||||||
|
ServiceBindOccupantEventMethods,
|
||||||
|
)
|
||||||
from databases import (
|
from databases import (
|
||||||
Modules,
|
Modules,
|
||||||
BuildParts,
|
BuildParts,
|
||||||
|
|
@ -17,9 +20,10 @@ from api_validations.validations_request import (
|
||||||
UpdateBuildLivingSpace,
|
UpdateBuildLivingSpace,
|
||||||
ListOptions,
|
ListOptions,
|
||||||
)
|
)
|
||||||
|
from databases.sql_models.event.event import Services
|
||||||
|
|
||||||
|
|
||||||
class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
class BuildingLivingSpacesListEventMethods(MethodToEvent):
|
||||||
|
|
||||||
event_type = "SELECT"
|
event_type = "SELECT"
|
||||||
__event_keys__ = {
|
__event_keys__ = {
|
||||||
|
|
@ -27,7 +31,7 @@ class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def building_build_parts_list(
|
def building_live_space_list(
|
||||||
cls,
|
cls,
|
||||||
list_options: ListOptions,
|
list_options: ListOptions,
|
||||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
|
|
@ -98,7 +102,7 @@ class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BuildingLivingSpacesPartsCreateEventMethods(MethodToEvent):
|
class BuildingLivingSpacesCreateEventMethods(MethodToEvent):
|
||||||
|
|
||||||
event_type = "CREATE"
|
event_type = "CREATE"
|
||||||
__event_keys__ = {
|
__event_keys__ = {
|
||||||
|
|
@ -187,13 +191,17 @@ class BuildingLivingSpacesPartsCreateEventMethods(MethodToEvent):
|
||||||
last_living_space.save()
|
last_living_space.save()
|
||||||
|
|
||||||
created_living_space.save_and_confirm()
|
created_living_space.save_and_confirm()
|
||||||
ModulesBindOccupantEventMethods.bind_default_module_for_first_init_occupant(
|
occupants_service = Services.retrieve_service_via_occupant_code(
|
||||||
|
occupant_code=occupant_type.occupant_code
|
||||||
|
)
|
||||||
|
ServiceBindOccupantEventMethods.bind_services_occupant_system(
|
||||||
build_living_space_id=created_living_space.id,
|
build_living_space_id=created_living_space.id,
|
||||||
|
service_id=occupants_service.id,
|
||||||
)
|
)
|
||||||
return created_living_space
|
return created_living_space
|
||||||
|
|
||||||
|
|
||||||
class BuildingLivingSpacesPartsUpdateEventMethods(MethodToEvent):
|
class BuildingLivingSpacesUpdateEventMethods(MethodToEvent):
|
||||||
|
|
||||||
event_type = "UPDATE"
|
event_type = "UPDATE"
|
||||||
__event_keys__ = {
|
__event_keys__ = {
|
||||||
|
|
@ -273,16 +281,16 @@ class BuildingLivingSpacesPartsUpdateEventMethods(MethodToEvent):
|
||||||
del data_dict["build_parts_uu_id"], data_dict["life_person_uu_id"]
|
del data_dict["build_parts_uu_id"], data_dict["life_person_uu_id"]
|
||||||
|
|
||||||
|
|
||||||
BuildingLivingSpacesPartsListEventMethod = BuildingLivingSpacesPartsListEventMethods(
|
BuildingLivingSpacesListEventMethod = BuildingLivingSpacesListEventMethods(
|
||||||
action=ActionsSchema(endpoint="/building/living_space/list")
|
action=ActionsSchema(endpoint="/building/living_space/list")
|
||||||
)
|
)
|
||||||
BuildingLivingSpacesPartsCreateEventMethod = (
|
BuildingLivingSpacesCreateEventMethod = (
|
||||||
BuildingLivingSpacesPartsCreateEventMethods(
|
BuildingLivingSpacesCreateEventMethods(
|
||||||
action=ActionsSchema(endpoint="/building/living_space/create")
|
action=ActionsSchema(endpoint="/building/living_space/create")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
BuildingLivingSpacesPartsUpdateEventMethod = (
|
BuildingLivingSpacesUpdateEventMethod = (
|
||||||
BuildingLivingSpacesPartsUpdateEventMethods(
|
BuildingLivingSpacesUpdateEventMethods(
|
||||||
action=ActionsSchema(endpoint="/building/living_space/update")
|
action=ActionsSchema(endpoint="/building/living_space/update")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ from fastapi import status
|
||||||
from fastapi.responses import JSONResponse
|
from fastapi.responses import JSONResponse
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
|
|
||||||
|
from api_library.date_time_actions.date_functions import system_arrow
|
||||||
from databases import (
|
from databases import (
|
||||||
Modules,
|
Modules,
|
||||||
Employees,
|
Employees,
|
||||||
BuildParts,
|
BuildParts,
|
||||||
BuildLivingSpace,
|
BuildLivingSpace,
|
||||||
Service2Events,
|
|
||||||
Services,
|
Services,
|
||||||
OccupantTypes,
|
OccupantTypes,
|
||||||
Event2Employee,
|
Event2Employee,
|
||||||
|
|
@ -34,44 +34,32 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
||||||
def bind_services_occupant_system(
|
def bind_services_occupant_system(
|
||||||
cls, build_living_space_id: int, service_id: int, expires_at: str = None
|
cls, build_living_space_id: int, service_id: int, expires_at: str = None
|
||||||
):
|
):
|
||||||
from sqlalchemy.dialects.postgresql import insert
|
|
||||||
|
|
||||||
living_space = BuildLivingSpace.filter_one(
|
living_space = BuildLivingSpace.filter_one(
|
||||||
BuildLivingSpace.id == build_living_space_id,
|
BuildLivingSpace.id == build_living_space_id,
|
||||||
).data
|
).data
|
||||||
service = Services.filter_one(Services.id == service_id).data
|
service = Services.filter_one(Services.id == service_id).data
|
||||||
add_events_list = Service2Events.filter_all(
|
if not service:
|
||||||
Service2Events.service_id == service.id,
|
print("Service is not valid. Service can not be binded")
|
||||||
).data
|
return
|
||||||
|
|
||||||
if not living_space:
|
if not living_space:
|
||||||
print("Living Space is not valid. Service is not binded")
|
print("Living Space is not valid. Service is not binded")
|
||||||
return
|
return
|
||||||
if not add_events_list:
|
|
||||||
print(f"Service has no events registered. Please contact with your manager")
|
|
||||||
return
|
|
||||||
|
|
||||||
event_ids_list = [
|
if expires_at:
|
||||||
{
|
expires_at = str(system_arrow.get(expires_at))
|
||||||
"build_living_space_id": living_space.id,
|
else:
|
||||||
"build_living_space_uu_id": str(living_space.uu_id),
|
expires_at = str(system_arrow.get(living_space.expiry_ends))
|
||||||
"event_id": service_event.event_id,
|
|
||||||
"event_uu_id": str(service_event.event_uu_id),
|
|
||||||
"is_confirmed": True,
|
|
||||||
"expiry_ends": str(expires_at) if expires_at else "2099-12-31 03:00:00",
|
|
||||||
}
|
|
||||||
for service_event in add_events_list
|
|
||||||
]
|
|
||||||
|
|
||||||
session_execute = Services.session.execute(
|
occupants_event = Event2Occupant.find_or_create(
|
||||||
insert(Event2Occupant)
|
event_service_id=service.id,
|
||||||
.values(event_ids_list)
|
event_service_uu_id=str(service.uu_id),
|
||||||
.on_conflict_do_nothing(
|
build_living_space_id=living_space.id,
|
||||||
index_elements=["build_living_space_id", "event_id"],
|
build_living_space_uu_id=str(living_space.uu_id),
|
||||||
|
expiry_ends=expires_at,
|
||||||
)
|
)
|
||||||
)
|
occupants_event.save_and_confirm()
|
||||||
count_row = session_execute.rowcount
|
print(f"{service.service_name} is added to occupant {str(living_space.uu_id)}")
|
||||||
print(f"{count_row} events are added to occupant {str(living_space.uu_id)}")
|
|
||||||
Services.save()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def bind_services_occupant(
|
def bind_services_occupant(
|
||||||
|
|
@ -126,14 +114,14 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
service_events = Service2Events.filter_all(
|
# service_events = Service2Events.filter_all(
|
||||||
Service2Events.service_id == service.id,
|
# Service2Events.service_id == service.id,
|
||||||
).data
|
# ).data
|
||||||
if not service_events:
|
# if not service_events:
|
||||||
raise HTTPException(
|
# raise HTTPException(
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
# status_code=status.HTTP_404_NOT_FOUND,
|
||||||
detail="Service has no events registered. Please contact with your manager",
|
# detail="Service has no events registered. Please contact with your manager",
|
||||||
)
|
# )
|
||||||
|
|
||||||
living_space = BuildLivingSpace.filter_one(
|
living_space = BuildLivingSpace.filter_one(
|
||||||
BuildLivingSpace.build_parts_id == occupants_build_part.id,
|
BuildLivingSpace.build_parts_id == occupants_build_part.id,
|
||||||
|
|
@ -150,27 +138,27 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
event_ids_list = [
|
# event_ids_list = [
|
||||||
{
|
# {
|
||||||
"build_living_space_id": living_space.id,
|
# "build_living_space_id": living_space.id,
|
||||||
"build_living_space_uu_id": str(living_space.uu_id),
|
# "build_living_space_uu_id": str(living_space.uu_id),
|
||||||
"event_id": service_event.event_id,
|
# "event_id": service_event.event_id,
|
||||||
"event_uu_id": str(service_event.event_uu_id),
|
# "event_uu_id": str(service_event.event_uu_id),
|
||||||
"is_confirmed": True,
|
# "is_confirmed": True,
|
||||||
}
|
# }
|
||||||
for service_event in service_events
|
# for service_event in service_events
|
||||||
]
|
# ]
|
||||||
|
#
|
||||||
session_execute = Services.session.execute(
|
# session_execute = Services.session.execute(
|
||||||
insert(Event2Occupant)
|
# insert(Event2Occupant)
|
||||||
.values(event_ids_list)
|
# .values(event_ids_list)
|
||||||
.on_conflict_do_nothing(
|
# .on_conflict_do_nothing(
|
||||||
index_elements=["employee_id", "event_id"],
|
# index_elements=["employee_id", "event_id"],
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
count_row = session_execute.rowcount
|
# count_row = session_execute.rowcount
|
||||||
print(f"{count_row} events are added to employee {str(living_space.uu_id)}")
|
# print(f"{count_row} events are added to employee {str(living_space.uu_id)}")
|
||||||
Services.save()
|
# Services.save()
|
||||||
|
|
||||||
|
|
||||||
class ServiceBindEmployeeEventMethods(MethodToEvent):
|
class ServiceBindEmployeeEventMethods(MethodToEvent):
|
||||||
|
|
@ -182,44 +170,50 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def bind_services_employee(cls, service_id: int, employee_id: int):
|
def bind_services_employee(cls, service_id: int, employee_id: int):
|
||||||
from sqlalchemy.dialects.postgresql import insert
|
|
||||||
|
|
||||||
employee = Employees.filter_by_one(
|
employee = Employees.filter_by_one(
|
||||||
id=employee_id, **Employees.valid_record_dict
|
id=employee_id, **Employees.valid_record_dict
|
||||||
).data
|
).data
|
||||||
service = Services.filter_by_one(
|
service = Services.filter_by_one(
|
||||||
id=service_id, **Services.valid_record_dict
|
id=service_id, **Services.valid_record_dict
|
||||||
).data
|
).data
|
||||||
service_events = Service2Events.filter_all(
|
if not service:
|
||||||
Service2Events.service_id == service.id,
|
print("Service is not valid. Service can not be binded")
|
||||||
).data
|
return
|
||||||
if not service_events:
|
|
||||||
raise Exception(
|
|
||||||
"Service has no events registered. Please contact with your manager"
|
|
||||||
)
|
|
||||||
|
|
||||||
event_ids_list = [
|
if not employee:
|
||||||
{
|
print("Employee is not valid. Service is not binded")
|
||||||
"employee_id": employee_id,
|
return
|
||||||
"employee_uu_id": str(employee.uu_id),
|
|
||||||
"event_id": service_event.event_id,
|
|
||||||
"event_uu_id": str(service_event.event_uu_id),
|
|
||||||
"is_confirmed": True,
|
|
||||||
}
|
|
||||||
for service_event in service_events
|
|
||||||
]
|
|
||||||
|
|
||||||
session_execute = Services.session.execute(
|
# service_events = Service2Events.filter_all(
|
||||||
insert(Event2Employee)
|
# Service2Events.service_id == service.id,
|
||||||
.values(event_ids_list)
|
# ).data
|
||||||
.on_conflict_do_nothing(
|
# if not service_events:
|
||||||
index_elements=["employee_id", "event_id"],
|
# raise Exception(
|
||||||
)
|
# "Service has no events registered. Please contact with your manager"
|
||||||
)
|
# )
|
||||||
count_row = session_execute.rowcount
|
|
||||||
print(f"{count_row} events are added to employee {employee.uu_id}")
|
# event_ids_list = [
|
||||||
for service_event in service_events:
|
# {
|
||||||
service_event.save_and_confirm()
|
# "employee_id": employee_id,
|
||||||
|
# "employee_uu_id": str(employee.uu_id),
|
||||||
|
# "event_id": service_event.event_id,
|
||||||
|
# "event_uu_id": str(service_event.event_uu_id),
|
||||||
|
# "is_confirmed": True,
|
||||||
|
# }
|
||||||
|
# for service_event in service_events
|
||||||
|
# ]
|
||||||
|
#
|
||||||
|
# session_execute = Services.session.execute(
|
||||||
|
# insert(Event2Employee)
|
||||||
|
# .values(event_ids_list)
|
||||||
|
# .on_conflict_do_nothing(
|
||||||
|
# index_elements=["employee_id", "event_id"],
|
||||||
|
# )
|
||||||
|
# )
|
||||||
|
# count_row = session_execute.rowcount
|
||||||
|
# print(f"{count_row} events are added to employee {employee.uu_id}")
|
||||||
|
# for service_event in service_events:
|
||||||
|
# service_event.save_and_confirm()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def bind_services_employee_super_user(
|
def bind_services_employee_super_user(
|
||||||
|
|
@ -227,8 +221,6 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
||||||
data: RegisterServices2Employee,
|
data: RegisterServices2Employee,
|
||||||
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
):
|
):
|
||||||
from sqlalchemy.dialects.postgresql import insert
|
|
||||||
|
|
||||||
if isinstance(token_dict, OccupantTokenObject):
|
if isinstance(token_dict, OccupantTokenObject):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
|
@ -261,52 +253,61 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
service_events = Service2Events.filter_all(
|
event_of_employee = Event2Employee.find_or_create(
|
||||||
Service2Events.service_id == service.id,
|
event_service_id=service.id,
|
||||||
).data
|
event_service_uu_id=str(service.uu_id),
|
||||||
if not service_events:
|
employee_id=employee.id,
|
||||||
raise HTTPException(
|
employee_uu_id=str(employee.uu_id),
|
||||||
status_code=status.HTTP_404_NOT_FOUND,
|
|
||||||
detail="Service has no events registered. Please contact with your manager",
|
|
||||||
)
|
)
|
||||||
|
event_of_employee.save_and_confirm()
|
||||||
|
print(f"{service.service_name} is added to employee {str(employee.uu_id)}")
|
||||||
|
|
||||||
event_ids_list = [
|
# service_events = Service2Events.filter_all(
|
||||||
{
|
# Service2Events.service_id == service.id,
|
||||||
"employee_id": employee.id,
|
# ).data
|
||||||
"employee_uu_id": employee.uu_id,
|
# if not service_events:
|
||||||
"event_id": service_event.event_id,
|
# raise HTTPException(
|
||||||
"event_uu_id": service_event.event_uu_id,
|
# status_code=status.HTTP_404_NOT_FOUND,
|
||||||
"is_confirmed": True,
|
# detail="Service has no events registered. Please contact with your manager",
|
||||||
}
|
# )
|
||||||
for service_event in service_events
|
#
|
||||||
]
|
# event_ids_list = [
|
||||||
|
# {
|
||||||
session_execute = Services.session.execute(
|
# "employee_id": employee.id,
|
||||||
insert(Event2Employee)
|
# "employee_uu_id": employee.uu_id,
|
||||||
.values(event_ids_list)
|
# "event_id": service_event.event_id,
|
||||||
.on_conflict_do_nothing(
|
# "event_uu_id": service_event.event_uu_id,
|
||||||
index_elements=["employee_id", "event_id"],
|
# "is_confirmed": True,
|
||||||
)
|
# }
|
||||||
)
|
# for service_event in service_events
|
||||||
count_row = session_execute.rowcount
|
# ]
|
||||||
if not count_row:
|
#
|
||||||
Services.save()
|
# session_execute = Services.session.execute(
|
||||||
return JSONResponse(
|
# insert(Event2Employee)
|
||||||
content={
|
# .values(event_ids_list)
|
||||||
"completed": False,
|
# .on_conflict_do_nothing(
|
||||||
"message": "No events are added to employee",
|
# index_elements=["employee_id", "event_id"],
|
||||||
"data": {},
|
# )
|
||||||
},
|
# )
|
||||||
status_code=status.HTTP_200_OK,
|
# count_row = session_execute.rowcount
|
||||||
)
|
# if not count_row:
|
||||||
return JSONResponse(
|
# Services.save()
|
||||||
content={
|
# return JSONResponse(
|
||||||
"completed": True,
|
# content={
|
||||||
"message": f"{count_row} events are added to employee",
|
# "completed": False,
|
||||||
"data": {},
|
# "message": "No events are added to employee",
|
||||||
},
|
# "data": {},
|
||||||
status_code=status.HTTP_200_OK,
|
# },
|
||||||
)
|
# status_code=status.HTTP_200_OK,
|
||||||
|
# )
|
||||||
|
# return JSONResponse(
|
||||||
|
# content={
|
||||||
|
# "completed": True,
|
||||||
|
# "message": f"{count_row} events are added to employee",
|
||||||
|
# "data": {},
|
||||||
|
# },
|
||||||
|
# status_code=status.HTTP_200_OK,
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
ServiceBindOccupantEventMethod = ServiceBindOccupantEventMethods(
|
ServiceBindOccupantEventMethod = ServiceBindOccupantEventMethods(
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ class AuthDefaultEventBlock(AddEventFunctionality):
|
||||||
{"function_code": "cee96b9b-8487-4e9f-aaed-2e8c79687bf9"},
|
{"function_code": "cee96b9b-8487-4e9f-aaed-2e8c79687bf9"},
|
||||||
{"function_code": "48379bb2-ba81-4d8e-a9dd-58837cfcbf67"},
|
{"function_code": "48379bb2-ba81-4d8e-a9dd-58837cfcbf67"},
|
||||||
{"function_code": "f09f7c1a-bee6-4e32-8444-962ec8f39091"},
|
{"function_code": "f09f7c1a-bee6-4e32-8444-962ec8f39091"},
|
||||||
{"function_code": "87a15ade-3474-4206-b574-bbf8580cbb14"},
|
|
||||||
{"function_code": "c519f9af-92e1-47b2-abf7-5a3316d075f7"},
|
{"function_code": "c519f9af-92e1-47b2-abf7-5a3316d075f7"},
|
||||||
{"function_code": "8b586848-2fb3-4161-abbe-642157eec7ce"},
|
{"function_code": "8b586848-2fb3-4161-abbe-642157eec7ce"},
|
||||||
{"function_code": "5cc22e4e-a0f7-4077-be41-1871feb3dfd1"},
|
{"function_code": "5cc22e4e-a0f7-4077-be41-1871feb3dfd1"},
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,8 @@ def parse_comment_for_living_space(
|
||||||
garbage="",
|
garbage="",
|
||||||
cleaned="",
|
cleaned="",
|
||||||
)
|
)
|
||||||
|
if not iban in living_space_dict:
|
||||||
|
return best_similarity
|
||||||
for person in living_space_dict[iban]["people"]:
|
for person in living_space_dict[iban]["people"]:
|
||||||
person: People = person
|
person: People = person
|
||||||
first_name = unidecode(person.firstname).upper()
|
first_name = unidecode(person.firstname).upper()
|
||||||
|
|
|
||||||
|
|
@ -569,7 +569,6 @@ class BuildLivingSpace(CrudCollection):
|
||||||
status_code=status.HTTP_418_IM_A_TEAPOT,
|
status_code=status.HTTP_418_IM_A_TEAPOT,
|
||||||
detail="Service is not found in database. Re-enter service record then try again.",
|
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(
|
ModulesBindOccupantEventMethods.bind_default_module_for_first_init_occupant(
|
||||||
build_living_space_id=created_living_space.id,
|
build_living_space_id=created_living_space.id,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,24 @@ class Services(CrudCollection):
|
||||||
)
|
)
|
||||||
related_responsibility: Mapped[str] = mapped_column(String, server_default="")
|
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"},)
|
__table_args__ = ({"comment": "Services Information"},)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,15 @@ services:
|
||||||
# - wag_management_init_service
|
# - wag_management_init_service
|
||||||
# - grafana
|
# - grafana
|
||||||
|
|
||||||
wag_management_init_service:
|
# wag_management_init_service:
|
||||||
container_name: wag_management_init_service
|
# container_name: wag_management_init_service
|
||||||
build:
|
# build:
|
||||||
context: .
|
# context: .
|
||||||
dockerfile: service_app_init/Dockerfile
|
# dockerfile: service_app_init/Dockerfile
|
||||||
networks:
|
# networks:
|
||||||
- network_store_services
|
# - network_store_services
|
||||||
depends_on:
|
# depends_on:
|
||||||
- postgres_commercial
|
# - postgres_commercial
|
||||||
#
|
#
|
||||||
# wag_bank_services:
|
# wag_bank_services:
|
||||||
# container_name: wag_bank_services
|
# container_name: wag_bank_services
|
||||||
|
|
@ -103,19 +103,19 @@ services:
|
||||||
# - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
# - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
||||||
# - PYTHONPATH=/service_app_banks
|
# - PYTHONPATH=/service_app_banks
|
||||||
#
|
#
|
||||||
# wag_account_services:
|
wag_account_services:
|
||||||
# container_name: wag_account_services
|
container_name: wag_account_services
|
||||||
# restart: on-failure
|
restart: on-failure
|
||||||
# build:
|
build:
|
||||||
# context: .
|
context: .
|
||||||
# dockerfile: service_account_records/account.Dockerfile
|
dockerfile: service_account_records/account.Dockerfile
|
||||||
# networks:
|
networks:
|
||||||
# - network_store_services
|
- network_store_services
|
||||||
# depends_on:
|
depends_on:
|
||||||
# - postgres_commercial
|
- postgres_commercial
|
||||||
# environment:
|
environment:
|
||||||
# - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
- DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
||||||
# - PYTHONPATH=/
|
- PYTHONPATH=/
|
||||||
#
|
#
|
||||||
# prometheus:
|
# prometheus:
|
||||||
# image: prom/prometheus
|
# image: prom/prometheus
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ def account_records_find_decision_book():
|
||||||
created_ibans.append(account_record.iban)
|
created_ibans.append(account_record.iban)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Exception of find_decision_book ln:55", e)
|
print("Exception of find_decision_book ln:55", e)
|
||||||
if not found_iban.build_id: # It is in database already
|
if not getattr(found_iban, 'build_id', None): # It is in database already
|
||||||
iban_build_dict["iban"] = account_record.iban
|
iban_build_dict["iban"] = account_record.iban
|
||||||
iban_build_dict["build_id"] = None
|
iban_build_dict["build_id"] = None
|
||||||
else:
|
else:
|
||||||
|
|
@ -329,9 +329,11 @@ def send_accounts_to_decision_payment():
|
||||||
|
|
||||||
|
|
||||||
def account_records_service() -> None:
|
def account_records_service() -> None:
|
||||||
|
print('Account Records Service is running...')
|
||||||
account_records_find_decision_book()
|
account_records_find_decision_book()
|
||||||
account_records_search()
|
account_records_search()
|
||||||
send_accounts_to_decision_payment()
|
send_accounts_to_decision_payment()
|
||||||
|
print('Account Records Service is finished...')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,7 @@ def create_all_events_from_actions():
|
||||||
),
|
),
|
||||||
system=True,
|
system=True,
|
||||||
).data
|
).data
|
||||||
if endpoint_restriction:
|
if endpoint_restriction and event_selected_function:
|
||||||
if event_selected_function:
|
|
||||||
selected_event = Events.filter_one(
|
selected_event = Events.filter_one(
|
||||||
Events.event_type == event_selected.event_type,
|
Events.event_type == event_selected.event_type,
|
||||||
Events.function_class == event,
|
Events.function_class == event,
|
||||||
|
|
|
||||||
|
|
@ -119,16 +119,18 @@ class RequestToApi:
|
||||||
)
|
)
|
||||||
return uu_id
|
return uu_id
|
||||||
elif access_object.get("user_type") == "occupant":
|
elif access_object.get("user_type") == "occupant":
|
||||||
occupants = companies_uu_id_list[str(selection_list[0])]
|
# print('selection_list', companies_uu_id_list)
|
||||||
occupant_uu_id = None
|
# print('selection_list', selection_list)
|
||||||
for occupant in occupants:
|
# occupants = companies_uu_id_list[str(selection_list[0])]
|
||||||
if occupant == str(selection_list[1]):
|
# occupant_uu_id = None
|
||||||
occupant_uu_id = occupant
|
# for occupant in occupants:
|
||||||
break
|
# if occupant == str(selection_list[1]):
|
||||||
|
# occupant_uu_id = occupant
|
||||||
|
# break
|
||||||
|
|
||||||
return_dict = {
|
return_dict = {
|
||||||
"occupant_uu_id": occupant_uu_id,
|
|
||||||
"build_part_uu_id": str(selection_list[0]),
|
"build_part_uu_id": str(selection_list[0]),
|
||||||
|
"occupant_uu_id": str(selection_list[1]),
|
||||||
}
|
}
|
||||||
refresh_company = self.post(
|
refresh_company = self.post(
|
||||||
endpoint="authentication/select", data=return_dict
|
endpoint="authentication/select", data=return_dict
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ def decode_as_json_indent(data):
|
||||||
return json.dumps(json.loads(json.dumps(data)), indent=2)
|
return json.dumps(json.loads(json.dumps(data)), indent=2)
|
||||||
|
|
||||||
|
|
||||||
password_token = "EKWKEMvmeXathlGjRPqnlmGA7ybWSuB9OWpyP0qPc-_K75pa0A5EDj7uxqjgk5Zaz_DJsm1Xugx4KbHT07cSRpRnc9IlTomQAORHwrVycaMno_nbNbLm85cRmrMXz2G4uOMkIqpdtWFI4SAmIwSMacZO3ns0RPYQSI_GnZhrrbAzXFJJq_aoW0N8uFbAdC5J"
|
password_token = "Z1HtH66KFhctC02vwLshQoRC4ezo0wabZV38UAtsCD-pYobuJY_e9soTfrxNtIbCg4vXRnHgRyha44IDHNd6pmjsq1S0EM4EA5PTLBa0juHOGTs2zbs81CR_kul0kzm1pIhs8OfxrjjCQY6oDrgBxycz7HSd7M9mdvoPWNAHjaVnCAduQcuAfFNoV3p22NhW"
|
||||||
password_token_occ = ""
|
password_token_occ = ""
|
||||||
login_data = {
|
login_data = {
|
||||||
"domain": "evyos.com.tr",
|
"domain": "evyos.com.tr",
|
||||||
|
|
@ -67,8 +67,8 @@ login_creds_occupant = {
|
||||||
"password_token": password_token_occ,
|
"password_token": password_token_occ,
|
||||||
}
|
}
|
||||||
selection_list = [
|
selection_list = [
|
||||||
# "d9ffa716-331c-48fc-83b2-47bf31289b3e",
|
"73811313-7c5c-422a-bb39-08c107911799",
|
||||||
# "afebb7f8-9f62-4703-b11c-ee8f14fe73b7",
|
"d5237a0d-1d5f-4939-93a1-a65e419b3313",
|
||||||
]
|
]
|
||||||
|
|
||||||
manager_token = "g0Z1YYjh2WqFfoI3MdJ9wrfXAHeL6f7UatEkySzOK0dFX6CH1sXgjQ"
|
manager_token = "g0Z1YYjh2WqFfoI3MdJ9wrfXAHeL6f7UatEkySzOK0dFX6CH1sXgjQ"
|
||||||
|
|
@ -88,7 +88,7 @@ list_of_attendees = [
|
||||||
]
|
]
|
||||||
constant = "Toplantı sonucunda araştırmalar tamamlandı, katılımcılara e-posta gönderildi. Onaylayan sayısı yeterli olmadığı için karar alınamadı ve proje iptal edildi ve sonlandırıldı."
|
constant = "Toplantı sonucunda araştırmalar tamamlandı, katılımcılara e-posta gönderildi. Onaylayan sayısı yeterli olmadığı için karar alınamadı ve proje iptal edildi ve sonlandırıldı."
|
||||||
|
|
||||||
assign_people_to_create_item = -1
|
assign_people_to_create_item = 0
|
||||||
if assign_people_to_create_item == -1:
|
if assign_people_to_create_item == -1:
|
||||||
local_api.selected_object = local_api.login_via_email_and_password(
|
local_api.selected_object = local_api.login_via_email_and_password(
|
||||||
login_data=login_data, is_password_valid=False
|
login_data=login_data, is_password_valid=False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue