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,
|
||||
)
|
||||
from api_events.events.building.building_living_spaces import (
|
||||
BuildingLivingSpacesPartsListEventMethod,
|
||||
BuildingLivingSpacesPartsCreateEventMethod,
|
||||
BuildingLivingSpacesPartsUpdateEventMethod,
|
||||
BuildingLivingSpacesListEventMethod,
|
||||
BuildingLivingSpacesCreateEventMethod,
|
||||
BuildingLivingSpacesUpdateEventMethod,
|
||||
)
|
||||
from api_events.events.decision_book.decision_book_decision_book import (
|
||||
DecisionBookListEventMethod,
|
||||
|
|
@ -211,9 +211,9 @@ __all__ = [
|
|||
"BuildingBuildPartsCreateEventMethod",
|
||||
"BuildingBuildPartsUpdateEventMethod",
|
||||
"BuildingBuildPartsPatchEventMethod",
|
||||
"BuildingLivingSpacesPartsListEventMethod",
|
||||
"BuildingLivingSpacesPartsCreateEventMethod",
|
||||
"BuildingLivingSpacesPartsUpdateEventMethod",
|
||||
"BuildingLivingSpacesListEventMethod",
|
||||
"BuildingLivingSpacesCreateEventMethod",
|
||||
"BuildingLivingSpacesUpdateEventMethod",
|
||||
"BuildAreaListEventMethod",
|
||||
"BuildAreaCreateEventMethod",
|
||||
"BuildAreaUpdateEventMethod",
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ class AccountRecordsListEventMethods(MethodToEvent):
|
|||
.filter(*main_filters)
|
||||
).order_by(order_by_list)
|
||||
|
||||
query.limit(list_options.page_size or 5).offset(
|
||||
(list_options.page or 1 - 1) * list_options.page_size or 5
|
||||
query.limit(list_options.size or 5).offset(
|
||||
(list_options.page or 1 - 1) * list_options.size or 5
|
||||
)
|
||||
for list_of_values in query.all() or []:
|
||||
return_list.append(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
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 (
|
||||
Modules,
|
||||
BuildParts,
|
||||
|
|
@ -17,9 +20,10 @@ from api_validations.validations_request import (
|
|||
UpdateBuildLivingSpace,
|
||||
ListOptions,
|
||||
)
|
||||
from databases.sql_models.event.event import Services
|
||||
|
||||
|
||||
class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
||||
class BuildingLivingSpacesListEventMethods(MethodToEvent):
|
||||
|
||||
event_type = "SELECT"
|
||||
__event_keys__ = {
|
||||
|
|
@ -27,7 +31,7 @@ class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
|||
}
|
||||
|
||||
@classmethod
|
||||
def building_build_parts_list(
|
||||
def building_live_space_list(
|
||||
cls,
|
||||
list_options: ListOptions,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
|
|
@ -98,7 +102,7 @@ class BuildingLivingSpacesPartsListEventMethods(MethodToEvent):
|
|||
)
|
||||
|
||||
|
||||
class BuildingLivingSpacesPartsCreateEventMethods(MethodToEvent):
|
||||
class BuildingLivingSpacesCreateEventMethods(MethodToEvent):
|
||||
|
||||
event_type = "CREATE"
|
||||
__event_keys__ = {
|
||||
|
|
@ -187,13 +191,17 @@ class BuildingLivingSpacesPartsCreateEventMethods(MethodToEvent):
|
|||
last_living_space.save()
|
||||
|
||||
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,
|
||||
service_id=occupants_service.id,
|
||||
)
|
||||
return created_living_space
|
||||
|
||||
|
||||
class BuildingLivingSpacesPartsUpdateEventMethods(MethodToEvent):
|
||||
class BuildingLivingSpacesUpdateEventMethods(MethodToEvent):
|
||||
|
||||
event_type = "UPDATE"
|
||||
__event_keys__ = {
|
||||
|
|
@ -273,16 +281,16 @@ class BuildingLivingSpacesPartsUpdateEventMethods(MethodToEvent):
|
|||
del data_dict["build_parts_uu_id"], data_dict["life_person_uu_id"]
|
||||
|
||||
|
||||
BuildingLivingSpacesPartsListEventMethod = BuildingLivingSpacesPartsListEventMethods(
|
||||
BuildingLivingSpacesListEventMethod = BuildingLivingSpacesListEventMethods(
|
||||
action=ActionsSchema(endpoint="/building/living_space/list")
|
||||
)
|
||||
BuildingLivingSpacesPartsCreateEventMethod = (
|
||||
BuildingLivingSpacesPartsCreateEventMethods(
|
||||
BuildingLivingSpacesCreateEventMethod = (
|
||||
BuildingLivingSpacesCreateEventMethods(
|
||||
action=ActionsSchema(endpoint="/building/living_space/create")
|
||||
)
|
||||
)
|
||||
BuildingLivingSpacesPartsUpdateEventMethod = (
|
||||
BuildingLivingSpacesPartsUpdateEventMethods(
|
||||
BuildingLivingSpacesUpdateEventMethod = (
|
||||
BuildingLivingSpacesUpdateEventMethods(
|
||||
action=ActionsSchema(endpoint="/building/living_space/update")
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ from fastapi import status
|
|||
from fastapi.responses import JSONResponse
|
||||
from fastapi.exceptions import HTTPException
|
||||
|
||||
from api_library.date_time_actions.date_functions import system_arrow
|
||||
from databases import (
|
||||
Modules,
|
||||
Employees,
|
||||
BuildParts,
|
||||
BuildLivingSpace,
|
||||
Service2Events,
|
||||
Services,
|
||||
OccupantTypes,
|
||||
Event2Employee,
|
||||
|
|
@ -34,44 +34,32 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
|||
def bind_services_occupant_system(
|
||||
cls, build_living_space_id: int, service_id: int, expires_at: str = None
|
||||
):
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
|
||||
living_space = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.id == build_living_space_id,
|
||||
).data
|
||||
service = Services.filter_one(Services.id == service_id).data
|
||||
add_events_list = Service2Events.filter_all(
|
||||
Service2Events.service_id == service.id,
|
||||
).data
|
||||
if not service:
|
||||
print("Service is not valid. Service can not be binded")
|
||||
return
|
||||
|
||||
if not living_space:
|
||||
print("Living Space is not valid. Service is not binded")
|
||||
return
|
||||
if not add_events_list:
|
||||
print(f"Service has no events registered. Please contact with your manager")
|
||||
return
|
||||
|
||||
event_ids_list = [
|
||||
{
|
||||
"build_living_space_id": living_space.id,
|
||||
"build_living_space_uu_id": str(living_space.uu_id),
|
||||
"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
|
||||
]
|
||||
if expires_at:
|
||||
expires_at = str(system_arrow.get(expires_at))
|
||||
else:
|
||||
expires_at = str(system_arrow.get(living_space.expiry_ends))
|
||||
|
||||
session_execute = Services.session.execute(
|
||||
insert(Event2Occupant)
|
||||
.values(event_ids_list)
|
||||
.on_conflict_do_nothing(
|
||||
index_elements=["build_living_space_id", "event_id"],
|
||||
)
|
||||
occupants_event = Event2Occupant.find_or_create(
|
||||
event_service_id=service.id,
|
||||
event_service_uu_id=str(service.uu_id),
|
||||
build_living_space_id=living_space.id,
|
||||
build_living_space_uu_id=str(living_space.uu_id),
|
||||
expiry_ends=expires_at,
|
||||
)
|
||||
count_row = session_execute.rowcount
|
||||
print(f"{count_row} events are added to occupant {str(living_space.uu_id)}")
|
||||
Services.save()
|
||||
occupants_event.save_and_confirm()
|
||||
print(f"{service.service_name} is added to occupant {str(living_space.uu_id)}")
|
||||
|
||||
@classmethod
|
||||
def bind_services_occupant(
|
||||
|
|
@ -126,14 +114,14 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
|||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
service_events = Service2Events.filter_all(
|
||||
Service2Events.service_id == service.id,
|
||||
).data
|
||||
if not service_events:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="Service has no events registered. Please contact with your manager",
|
||||
)
|
||||
# service_events = Service2Events.filter_all(
|
||||
# Service2Events.service_id == service.id,
|
||||
# ).data
|
||||
# if not service_events:
|
||||
# raise HTTPException(
|
||||
# status_code=status.HTTP_404_NOT_FOUND,
|
||||
# detail="Service has no events registered. Please contact with your manager",
|
||||
# )
|
||||
|
||||
living_space = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.build_parts_id == occupants_build_part.id,
|
||||
|
|
@ -150,27 +138,27 @@ class ServiceBindOccupantEventMethods(MethodToEvent):
|
|||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
event_ids_list = [
|
||||
{
|
||||
"build_living_space_id": living_space.id,
|
||||
"build_living_space_uu_id": str(living_space.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(Event2Occupant)
|
||||
.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 {str(living_space.uu_id)}")
|
||||
Services.save()
|
||||
# event_ids_list = [
|
||||
# {
|
||||
# "build_living_space_id": living_space.id,
|
||||
# "build_living_space_uu_id": str(living_space.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(Event2Occupant)
|
||||
# .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 {str(living_space.uu_id)}")
|
||||
# Services.save()
|
||||
|
||||
|
||||
class ServiceBindEmployeeEventMethods(MethodToEvent):
|
||||
|
|
@ -182,44 +170,50 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def bind_services_employee(cls, service_id: int, employee_id: int):
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
|
||||
employee = Employees.filter_by_one(
|
||||
id=employee_id, **Employees.valid_record_dict
|
||||
).data
|
||||
service = Services.filter_by_one(
|
||||
id=service_id, **Services.valid_record_dict
|
||||
).data
|
||||
service_events = Service2Events.filter_all(
|
||||
Service2Events.service_id == service.id,
|
||||
).data
|
||||
if not service_events:
|
||||
raise Exception(
|
||||
"Service has no events registered. Please contact with your manager"
|
||||
)
|
||||
if not service:
|
||||
print("Service is not valid. Service can not be binded")
|
||||
return
|
||||
|
||||
event_ids_list = [
|
||||
{
|
||||
"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
|
||||
]
|
||||
if not employee:
|
||||
print("Employee is not valid. Service is not binded")
|
||||
return
|
||||
|
||||
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()
|
||||
# service_events = Service2Events.filter_all(
|
||||
# Service2Events.service_id == service.id,
|
||||
# ).data
|
||||
# if not service_events:
|
||||
# raise Exception(
|
||||
# "Service has no events registered. Please contact with your manager"
|
||||
# )
|
||||
|
||||
# event_ids_list = [
|
||||
# {
|
||||
# "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
|
||||
def bind_services_employee_super_user(
|
||||
|
|
@ -227,8 +221,6 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
|||
data: RegisterServices2Employee,
|
||||
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
|
||||
if isinstance(token_dict, OccupantTokenObject):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
|
@ -261,52 +253,61 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
|
|||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
service_events = Service2Events.filter_all(
|
||||
Service2Events.service_id == service.id,
|
||||
).data
|
||||
if not service_events:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="Service has no events registered. Please contact with your manager",
|
||||
)
|
||||
|
||||
event_ids_list = [
|
||||
{
|
||||
"employee_id": employee.id,
|
||||
"employee_uu_id": employee.uu_id,
|
||||
"event_id": service_event.event_id,
|
||||
"event_uu_id": 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
|
||||
if not count_row:
|
||||
Services.save()
|
||||
return JSONResponse(
|
||||
content={
|
||||
"completed": False,
|
||||
"message": "No events are added to employee",
|
||||
"data": {},
|
||||
},
|
||||
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,
|
||||
event_of_employee = Event2Employee.find_or_create(
|
||||
event_service_id=service.id,
|
||||
event_service_uu_id=str(service.uu_id),
|
||||
employee_id=employee.id,
|
||||
employee_uu_id=str(employee.uu_id),
|
||||
)
|
||||
event_of_employee.save_and_confirm()
|
||||
print(f"{service.service_name} is added to employee {str(employee.uu_id)}")
|
||||
|
||||
# service_events = Service2Events.filter_all(
|
||||
# Service2Events.service_id == service.id,
|
||||
# ).data
|
||||
# if not service_events:
|
||||
# raise HTTPException(
|
||||
# status_code=status.HTTP_404_NOT_FOUND,
|
||||
# detail="Service has no events registered. Please contact with your manager",
|
||||
# )
|
||||
#
|
||||
# event_ids_list = [
|
||||
# {
|
||||
# "employee_id": employee.id,
|
||||
# "employee_uu_id": employee.uu_id,
|
||||
# "event_id": service_event.event_id,
|
||||
# "event_uu_id": 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
|
||||
# if not count_row:
|
||||
# Services.save()
|
||||
# return JSONResponse(
|
||||
# content={
|
||||
# "completed": False,
|
||||
# "message": "No events are added to employee",
|
||||
# "data": {},
|
||||
# },
|
||||
# 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(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class AuthDefaultEventBlock(AddEventFunctionality):
|
|||
{"function_code": "cee96b9b-8487-4e9f-aaed-2e8c79687bf9"},
|
||||
{"function_code": "48379bb2-ba81-4d8e-a9dd-58837cfcbf67"},
|
||||
{"function_code": "f09f7c1a-bee6-4e32-8444-962ec8f39091"},
|
||||
{"function_code": "87a15ade-3474-4206-b574-bbf8580cbb14"},
|
||||
{"function_code": "c519f9af-92e1-47b2-abf7-5a3316d075f7"},
|
||||
{"function_code": "8b586848-2fb3-4161-abbe-642157eec7ce"},
|
||||
{"function_code": "5cc22e4e-a0f7-4077-be41-1871feb3dfd1"},
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ def parse_comment_for_living_space(
|
|||
garbage="",
|
||||
cleaned="",
|
||||
)
|
||||
if not iban in living_space_dict:
|
||||
return best_similarity
|
||||
for person in living_space_dict[iban]["people"]:
|
||||
person: People = person
|
||||
first_name = unidecode(person.firstname).upper()
|
||||
|
|
|
|||
|
|
@ -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"},)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,15 +79,15 @@ services:
|
|||
# - wag_management_init_service
|
||||
# - grafana
|
||||
|
||||
wag_management_init_service:
|
||||
container_name: wag_management_init_service
|
||||
build:
|
||||
context: .
|
||||
dockerfile: service_app_init/Dockerfile
|
||||
networks:
|
||||
- network_store_services
|
||||
depends_on:
|
||||
- postgres_commercial
|
||||
# wag_management_init_service:
|
||||
# container_name: wag_management_init_service
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: service_app_init/Dockerfile
|
||||
# networks:
|
||||
# - network_store_services
|
||||
# depends_on:
|
||||
# - postgres_commercial
|
||||
#
|
||||
# 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
|
||||
# - PYTHONPATH=/service_app_banks
|
||||
#
|
||||
# wag_account_services:
|
||||
# container_name: wag_account_services
|
||||
# restart: on-failure
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: service_account_records/account.Dockerfile
|
||||
# networks:
|
||||
# - network_store_services
|
||||
# depends_on:
|
||||
# - postgres_commercial
|
||||
# environment:
|
||||
# - DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
||||
# - PYTHONPATH=/
|
||||
wag_account_services:
|
||||
container_name: wag_account_services
|
||||
restart: on-failure
|
||||
build:
|
||||
context: .
|
||||
dockerfile: service_account_records/account.Dockerfile
|
||||
networks:
|
||||
- network_store_services
|
||||
depends_on:
|
||||
- postgres_commercial
|
||||
environment:
|
||||
- DATABASE_URL=postgresql+psycopg2://berkay_wag_user:berkay_wag_user_password@postgres_commercial:5432/wag_database
|
||||
- PYTHONPATH=/
|
||||
#
|
||||
# prometheus:
|
||||
# image: prom/prometheus
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def account_records_find_decision_book():
|
|||
created_ibans.append(account_record.iban)
|
||||
except Exception as 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["build_id"] = None
|
||||
else:
|
||||
|
|
@ -329,9 +329,11 @@ def send_accounts_to_decision_payment():
|
|||
|
||||
|
||||
def account_records_service() -> None:
|
||||
print('Account Records Service is running...')
|
||||
account_records_find_decision_book()
|
||||
account_records_search()
|
||||
send_accounts_to_decision_payment()
|
||||
print('Account Records Service is finished...')
|
||||
return
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,29 +43,28 @@ def create_all_events_from_actions():
|
|||
),
|
||||
system=True,
|
||||
).data
|
||||
if endpoint_restriction:
|
||||
if event_selected_function:
|
||||
selected_event = Events.filter_one(
|
||||
Events.event_type == event_selected.event_type,
|
||||
Events.function_class == event,
|
||||
Events.function_code == event_selected_key,
|
||||
Events.endpoint_id == endpoint_restriction.id,
|
||||
Events.endpoint_uu_id == str(endpoint_restriction.uu_id),
|
||||
system=True,
|
||||
).data
|
||||
if not selected_event:
|
||||
created_event = Events.find_or_create(
|
||||
event_type=event_selected.event_type,
|
||||
function_class=event,
|
||||
function_code=event_selected_key,
|
||||
endpoint_id=endpoint_restriction.id,
|
||||
endpoint_uu_id=str(endpoint_restriction.uu_id),
|
||||
**active_confirmed,
|
||||
)
|
||||
created_event.save()
|
||||
created_event.update(is_confirmed=True)
|
||||
created_event.save()
|
||||
print(f"Event created: {created_event.uu_id}")
|
||||
if endpoint_restriction and event_selected_function:
|
||||
selected_event = Events.filter_one(
|
||||
Events.event_type == event_selected.event_type,
|
||||
Events.function_class == event,
|
||||
Events.function_code == event_selected_key,
|
||||
Events.endpoint_id == endpoint_restriction.id,
|
||||
Events.endpoint_uu_id == str(endpoint_restriction.uu_id),
|
||||
system=True,
|
||||
).data
|
||||
if not selected_event:
|
||||
created_event = Events.find_or_create(
|
||||
event_type=event_selected.event_type,
|
||||
function_class=event,
|
||||
function_code=event_selected_key,
|
||||
endpoint_id=endpoint_restriction.id,
|
||||
endpoint_uu_id=str(endpoint_restriction.uu_id),
|
||||
**active_confirmed,
|
||||
)
|
||||
created_event.save()
|
||||
created_event.update(is_confirmed=True)
|
||||
created_event.save()
|
||||
print(f"Event created: {created_event.uu_id}")
|
||||
|
||||
for item in an_empty_list:
|
||||
if an_empty_list.count(item) > 1:
|
||||
|
|
|
|||
|
|
@ -119,16 +119,18 @@ class RequestToApi:
|
|||
)
|
||||
return uu_id
|
||||
elif access_object.get("user_type") == "occupant":
|
||||
occupants = companies_uu_id_list[str(selection_list[0])]
|
||||
occupant_uu_id = None
|
||||
for occupant in occupants:
|
||||
if occupant == str(selection_list[1]):
|
||||
occupant_uu_id = occupant
|
||||
break
|
||||
# print('selection_list', companies_uu_id_list)
|
||||
# print('selection_list', selection_list)
|
||||
# occupants = companies_uu_id_list[str(selection_list[0])]
|
||||
# occupant_uu_id = None
|
||||
# for occupant in occupants:
|
||||
# if occupant == str(selection_list[1]):
|
||||
# occupant_uu_id = occupant
|
||||
# break
|
||||
|
||||
return_dict = {
|
||||
"occupant_uu_id": occupant_uu_id,
|
||||
"build_part_uu_id": str(selection_list[0]),
|
||||
"occupant_uu_id": str(selection_list[1]),
|
||||
}
|
||||
refresh_company = self.post(
|
||||
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)
|
||||
|
||||
|
||||
password_token = "EKWKEMvmeXathlGjRPqnlmGA7ybWSuB9OWpyP0qPc-_K75pa0A5EDj7uxqjgk5Zaz_DJsm1Xugx4KbHT07cSRpRnc9IlTomQAORHwrVycaMno_nbNbLm85cRmrMXz2G4uOMkIqpdtWFI4SAmIwSMacZO3ns0RPYQSI_GnZhrrbAzXFJJq_aoW0N8uFbAdC5J"
|
||||
password_token = "Z1HtH66KFhctC02vwLshQoRC4ezo0wabZV38UAtsCD-pYobuJY_e9soTfrxNtIbCg4vXRnHgRyha44IDHNd6pmjsq1S0EM4EA5PTLBa0juHOGTs2zbs81CR_kul0kzm1pIhs8OfxrjjCQY6oDrgBxycz7HSd7M9mdvoPWNAHjaVnCAduQcuAfFNoV3p22NhW"
|
||||
password_token_occ = ""
|
||||
login_data = {
|
||||
"domain": "evyos.com.tr",
|
||||
|
|
@ -67,8 +67,8 @@ login_creds_occupant = {
|
|||
"password_token": password_token_occ,
|
||||
}
|
||||
selection_list = [
|
||||
# "d9ffa716-331c-48fc-83b2-47bf31289b3e",
|
||||
# "afebb7f8-9f62-4703-b11c-ee8f14fe73b7",
|
||||
"73811313-7c5c-422a-bb39-08c107911799",
|
||||
"d5237a0d-1d5f-4939-93a1-a65e419b3313",
|
||||
]
|
||||
|
||||
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ı."
|
||||
|
||||
assign_people_to_create_item = -1
|
||||
assign_people_to_create_item = 0
|
||||
if assign_people_to_create_item == -1:
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_data, is_password_valid=False
|
||||
|
|
|
|||
Loading…
Reference in New Issue