Compare commits
No commits in common. "73d41b8e102f65e20fb1178114425970b00b401f" and "48682b191402c7f02d97b660612b9abe4f355193" have entirely different histories.
73d41b8e10
...
48682b1914
|
|
@ -1 +0,0 @@
|
|||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
GSM Projesi 30.11.2023 -315,00 TL
|
||||
GSM Projesi 31.12.2023 -300,00 TL
|
||||
Doğalgaz_Anakolon Projesi 31.10.2023 -1.733,33 TL
|
||||
Doğalgaz_Anakolon Projesi 30.11.2023 -1.750,00 TL
|
||||
Doğalgaz_Anakolon Projesi 31.12.2023 -1.100,00 TL
|
||||
Yan Alan Projesi 31.10.2023 -495,83 TL
|
||||
Yan Alan Projesi 30.11.2023 -400,00 TL
|
||||
Kazan çıkışı ana boru değişim projesi 29.02.2024 -180,00 TL
|
||||
Kazan çıkışı ana boru değişim projesi 31.03.2024 -150,00 TL
|
||||
Kazan Genleşme Tankı değişim projesi 30.04.2024 -250,00 TL
|
||||
Kazan Genleşme Tankı değişim projesi 31.05.2024 -300,00 TL
|
||||
2024 1 nolu proje toplamı 31.07.2024 -585
|
||||
|
||||
1 - Bina boru satışı -₺1.580,00
|
||||
3 - Bina su depo temizliği projesi ₺3.000,00
|
||||
4 - Çatı Camlarının değişim projesi ₺1.000,00
|
||||
8 - Bina Uydu Bakım Projesi ₺1.700,00
|
||||
2 - Bina iç tadilat, elektrik ve boya işleri projesi ₺42.200,00
|
||||
5 - Dış kapının değişim projesi ₺24.000,00
|
||||
9- Hurda Aliminyum Satışı -₺2.600,00
|
||||
6 - Kazan borlularının ana kolondan sökülmesi projesi ₺22.500,00
|
||||
7 - Yol tarafı ile bahçe tarafı logar tadilat projesi ₺0,00
|
||||
|
||||
16.09.2024 10:28 -2.000,00 6.327,91 0 TL dogalgaz bakimi icin
|
||||
20.08.2024 13:53 -8.000,00 257,70 0 TL tadilat bedeli
|
||||
15.07.2024 11:52 -500,00 7.104,23 0 TL REMZİ SU
|
||||
13.07.2024 10:35 -2.400,00 6.104,23 0 TL SANTIYE TEKNIK ANKARA 0412
|
||||
13.06.2024 13:37 -750,00 16.939,09 0 TL cam değişimi
|
||||
12.06.2024 10:41 -3.000,00 16.701,74 0 TL depo temizliği için ödenen
|
||||
10.06.2024 13:38 -200,00 19.701,74 0 TL cam için ödenen
|
||||
|
|
@ -3,9 +3,6 @@ import typing
|
|||
from fastapi import status, HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from api_events.events.events.events_bind_services import (
|
||||
ServiceBindOccupantEventMethods,
|
||||
)
|
||||
from databases import (
|
||||
Build,
|
||||
BuildParts,
|
||||
|
|
@ -31,7 +28,6 @@ from api_validations.validations_request import (
|
|||
ListOptions,
|
||||
ListDecisionBook,
|
||||
)
|
||||
from databases.sql_models.event.event import Services
|
||||
|
||||
|
||||
class DecisionBookDecisionBookItemsListEventMethods(MethodToEvent):
|
||||
|
|
@ -182,7 +178,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
BuildParts.human_livable == True,
|
||||
BuildParts.build_id == build_id,
|
||||
)
|
||||
print("data_info_type.key", data_info_type.key)
|
||||
print('data_info_type.key', data_info_type.key)
|
||||
book_payment_dict = dict(
|
||||
payment_plan_time_periods=str(data_info_type.key),
|
||||
build_decision_book_item_id=decision_book_item.id,
|
||||
|
|
@ -232,10 +228,12 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
BuildDecisionBookProjects.build_decision_book_id == decision_book.id,
|
||||
BuildDecisionBookProjects.project_type
|
||||
== f"{decision_book.decision_type}_{data_info_type.key}",
|
||||
system=True,
|
||||
system=True
|
||||
)
|
||||
management_room = BuildParts.filter_one(
|
||||
BuildParts.build_id == build_id, BuildParts.part_no == 0, system=True
|
||||
BuildParts.build_id == build_id,
|
||||
BuildParts.part_no == 0,
|
||||
system=True
|
||||
).data
|
||||
occupant_man = OccupantTypes.filter_by_one(
|
||||
system=True, occupant_code="MT-VPR", occupant_category_type="MT"
|
||||
|
|
@ -256,7 +254,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
project_start_date=str(local_date),
|
||||
project_stop_date=str(end_date),
|
||||
project_type=f"{decision_book.decision_type}_{data_info_type.key}",
|
||||
project_note=str(decision_book_item.item_comment),
|
||||
project_note=f"Fill later",
|
||||
build_decision_book_id=decision_book.id,
|
||||
build_decision_book_uu_id=str(decision_book.uu_id),
|
||||
build_decision_book_item_id=decision_book_item.id,
|
||||
|
|
@ -267,62 +265,27 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
book_project_created = BuildDecisionBookProjects.find_or_create(
|
||||
**book_project_dict
|
||||
)
|
||||
book_project_created.save_and_confirm()
|
||||
print("book_project_created", book_project_created)
|
||||
item_comment_at_database = decision_book_item.item_comment
|
||||
print('book_project_created', book_project_created)
|
||||
decision_book_item.update(
|
||||
item_comment=f"{book_project_created.project_no}_{book_project_created.project_name} "
|
||||
f"is assigned to {occupant_man.occupant_description} | {item_comment_at_database}"
|
||||
f"is assigned to {occupant_man.occupant_description}"
|
||||
)
|
||||
decision_book_item.save_and_confirm()
|
||||
project_lead = OccupantTypes.filter_by_one(
|
||||
system=True, occupant_code="PRJ-LDR", occupant_category_type="PRJ"
|
||||
).data
|
||||
build_new_president = OccupantTypes.filter_by_one(
|
||||
system=True, occupant_code="MT-VPR", occupant_category_type="MT"
|
||||
).data
|
||||
|
||||
new_president = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.occupant_type == build_new_president.id,
|
||||
BuildLivingSpace.build_parts_id == management_room.id,
|
||||
).data
|
||||
|
||||
project_leader = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.occupant_type == project_lead.id,
|
||||
BuildLivingSpace.build_parts_id == management_room.id,
|
||||
BuildLivingSpace.person_id == new_president.person_id,
|
||||
).data
|
||||
if not project_leader:
|
||||
project_leader = BuildLivingSpace.find_or_create(
|
||||
person_id=new_president.person_id,
|
||||
person_uu_id=str(new_president.person_uu_id),
|
||||
build_parts_id=management_room.id,
|
||||
build_parts_uu_id=str(management_room.uu_id),
|
||||
occupant_type=project_lead.id,
|
||||
occupant_type_uu_id=str(project_lead.uu_id),
|
||||
)
|
||||
project_leader.save_and_confirm()
|
||||
related_service = Services.filter_by_one(
|
||||
system=True,
|
||||
related_responsibility=project_lead.occupant_code,
|
||||
).data
|
||||
ServiceBindOccupantEventMethods.bind_services_occupant_system(
|
||||
service_id=related_service.id,
|
||||
build_living_space_id=project_leader.id,
|
||||
)
|
||||
project_person = BuildDecisionBookProjectPerson.find_or_create(
|
||||
build_decision_book_project_id=book_project_created.id,
|
||||
build_decision_book_project_uu_id=str(book_project_created.uu_id),
|
||||
living_space_id=project_leader.id,
|
||||
living_space_uu_id=str(project_leader.uu_id),
|
||||
living_space_id=manager_living_space.id,
|
||||
living_space_uu_id=str(manager_living_space.uu_id),
|
||||
project_team_type_id=project_lead.id,
|
||||
project_team_type_uu_id=str(project_lead.uu_id),
|
||||
)
|
||||
project_person.save_and_confirm()
|
||||
book_project_created.update(
|
||||
project_response_living_space_id=project_leader.id,
|
||||
project_response_living_space_uu_id=str(project_leader.uu_id),
|
||||
)
|
||||
book_project_created.save()
|
||||
return book_project_created
|
||||
|
||||
elif data_info_type.key == "BDT-S":
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
|
|
@ -369,7 +332,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
|
||||
book_items = BuildDecisionBookItems.filter_all(
|
||||
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
||||
system=True,
|
||||
system=True
|
||||
)
|
||||
if int(book_items.count) < 3:
|
||||
BuildDecisionBookItems.check_meeting_is_valid_to_start_add_attendance(
|
||||
|
|
@ -379,7 +342,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
|
||||
book_items = BuildDecisionBookItems.filter_all(
|
||||
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
||||
system=True,
|
||||
system=True
|
||||
)
|
||||
|
||||
data_dict["item_order"] = int(book_items.count) + 1
|
||||
|
|
@ -387,9 +350,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
data_dict["build_decision_book_uu_id"] = str(decision_book.uu_id)
|
||||
|
||||
data_info_type = ApiEnumDropdown.filter_by_one(
|
||||
system=True,
|
||||
enum_class="BuildDuesTypes",
|
||||
key="BDT-I",
|
||||
system=True, enum_class="BuildDuesTypes", key="BDT-I",
|
||||
).data
|
||||
data_info_types = ApiEnumDropdown.due_type_search()
|
||||
for info_type in data_info_types:
|
||||
|
|
@ -398,14 +359,8 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
break
|
||||
|
||||
row_is_debit = str(data_info_type.key).upper() in ["BDT-A", "BDT-D"]
|
||||
row_is_project = str(data_info_type.key).upper() in [
|
||||
"BDT-R",
|
||||
"BDT-L",
|
||||
"BDT-S",
|
||||
]
|
||||
debit_dates_required = (
|
||||
not data_dict["debit_start_date"] or not data_dict["debit_end_date"]
|
||||
)
|
||||
row_is_project = str(data_info_type.key).upper() in ["BDT-R", "BDT-L", "BDT-S"]
|
||||
debit_dates_required = not data_dict["debit_start_date"] or not data_dict["debit_end_date"]
|
||||
if row_is_project and debit_dates_required:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
|
|
@ -415,9 +370,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
|
||||
data_dict["info_type_id"] = data_info_type.id
|
||||
data_dict["info_type_uu_id"] = str(data_info_type.uu_id)
|
||||
unit_price, unit_type = float(data_dict["unit_price"]), str(
|
||||
data_dict["unit_type"]
|
||||
)
|
||||
unit_price, unit_type = float(data_dict["unit_price"]), str(data_dict["unit_type"])
|
||||
|
||||
debit_start_date, debit_end_date = (
|
||||
data_dict["debit_start_date"],
|
||||
|
|
@ -436,7 +389,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
|
||||
new_decision_book_item = BuildDecisionBookItems.find_or_create(**data_dict)
|
||||
new_decision_book_item.save_and_confirm()
|
||||
print("new_decision_book_item", new_decision_book_item)
|
||||
print('new_decision_book_item', new_decision_book_item)
|
||||
if created_payment_records_dict := cls.create_payment_records_for_each_build_part(
|
||||
data_info_type=data_info_type,
|
||||
build_id=decision_book.build_id,
|
||||
|
|
@ -467,9 +420,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
|||
new_decision_book_item.update(is_payment_created=True)
|
||||
elif row_is_project:
|
||||
project_no = str(created_payment_records_dict.project_no)
|
||||
item_comment = (
|
||||
f"{data.item_comment} | @ Project is created no : {project_no}."
|
||||
)
|
||||
item_comment = f"{data.item_comment} | @ Project is created no : {project_no}."
|
||||
new_decision_book_item.update(item_comment=item_comment)
|
||||
new_decision_book_item.update(is_payment_created=True)
|
||||
new_decision_book_item.save_and_confirm()
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ class DecisionBookPersonAddEventMethods(MethodToEvent):
|
|||
detail=f"No Decision Book is match with given UUID {data.build_decision_book_uu_id}",
|
||||
)
|
||||
manager_occupant_type = OccupantTypes.filter_by_one(
|
||||
system=True, occupant_code="BU-MNG", occupant_category_type="BU"
|
||||
system=True,
|
||||
occupant_code="BU-MNG",
|
||||
occupant_category_type="BU"
|
||||
).data
|
||||
if (
|
||||
not manager_occupant_type.uu_id
|
||||
|
|
@ -261,8 +263,7 @@ class DecisionBookPersonAssignOccupantEventMethods(MethodToEvent):
|
|||
)
|
||||
|
||||
assign_occupant_type = OccupantTypes.filter_by_one(
|
||||
system=True,
|
||||
uu_id=data.occupant_type_uu_id,
|
||||
system=True, uu_id=data.occupant_type_uu_id,
|
||||
).data
|
||||
if not assign_occupant_type:
|
||||
raise HTTPException(
|
||||
|
|
|
|||
|
|
@ -96,9 +96,7 @@ class BuildDecisionBookInvitationsCreateEventMethods(MethodToEvent):
|
|||
)
|
||||
|
||||
# Create an invitation for specific invitation type to start invite sending process
|
||||
planned_date_expires = str(
|
||||
system_arrow.get(data.planned_date).shift(days=15).date()
|
||||
)
|
||||
planned_date_expires = str(system_arrow.get(data.planned_date).shift(days=15).date())
|
||||
book_invitation = BuildDecisionBookInvitations.find_or_create(
|
||||
build_id=token_dict.selected_occupant.build_id,
|
||||
build_uu_id=token_dict.selected_occupant.build_uuid,
|
||||
|
|
@ -201,8 +199,7 @@ class BuildDecisionBookInvitationsCreateEventMethods(MethodToEvent):
|
|||
BuildDecisionBookPerson.invite_id == book_invitation.id,
|
||||
BuildDecisionBookPerson.build_living_space_id.in_(
|
||||
[
|
||||
manager_living_space.id
|
||||
for manager_living_space in manager_living_spaces.data
|
||||
manager_living_space.id for manager_living_space in manager_living_spaces.data
|
||||
]
|
||||
),
|
||||
system=True,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from databases import (
|
|||
BuildDecisionBookProjects,
|
||||
BuildDecisionBookProjectPerson,
|
||||
BuildDecisionBookPayments,
|
||||
OccupantTypes,
|
||||
OccupantTypes
|
||||
)
|
||||
|
||||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||
|
|
@ -17,12 +17,13 @@ from api_validations.validations_request import (
|
|||
ListOptions,
|
||||
)
|
||||
from api_validations.core_response import AlchemyJsonResponse
|
||||
from databases import Build, BuildLivingSpace, BuildParts, ApiEnumDropdown
|
||||
from databases.sql_models.building.decision_book import (
|
||||
BuildDecisionBookProjectItems,
|
||||
BuildDecisionBookItems,
|
||||
BuildDecisionBook,
|
||||
from databases import (
|
||||
Build,
|
||||
BuildLivingSpace,
|
||||
BuildParts,
|
||||
ApiEnumDropdown
|
||||
)
|
||||
from databases.sql_models.building.decision_book import BuildDecisionBookProjectItems, BuildDecisionBookItems
|
||||
|
||||
|
||||
class ProjectDecisionBookListEventMethods(MethodToEvent):
|
||||
|
|
@ -30,37 +31,29 @@ class ProjectDecisionBookListEventMethods(MethodToEvent):
|
|||
event_type = "LIST"
|
||||
|
||||
__event_keys__ = {
|
||||
"96459b36-37f2-4d5b-8370-c459058d5bce": "project_decision_book_list",
|
||||
"96459b36-37f2-4d5b-8370-c459058d5bce": "project_decision_book_person_list",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def project_decision_book_list(
|
||||
cls,
|
||||
list_options: ListOptions,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
def project_decision_book_person_list(
|
||||
cls,
|
||||
data: ListOptions,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
build_decision_book = BuildDecisionBook.filter_one(
|
||||
BuildDecisionBook.build_id == token_dict.selected_occupant.build_id,
|
||||
).data
|
||||
if not build_decision_book:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="Build decision book not found",
|
||||
data={},
|
||||
)
|
||||
BuildDecisionBookProjects.filter_attr = list_options
|
||||
project_person = BuildDecisionBookProjectPerson.filter_all(
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
decision_book_ids = [_.build_decision_book_project_id for _ in project_person.data]
|
||||
decision_book_projects = BuildDecisionBookProjects.filter_all(
|
||||
BuildDecisionBookProjects.build_decision_book_id
|
||||
== build_decision_book.id,
|
||||
BuildDecisionBookProjects.build_decision_book_project_id.in_(decision_book_ids),
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
status_code="HTTP_200_OK",
|
||||
|
|
@ -79,44 +72,44 @@ class ProjectDecisionBookCreateEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_create(
|
||||
cls,
|
||||
data: InsertBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: InsertBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
living_space = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.id == token_dict.selected_occupant.living_space_id,
|
||||
BuildLivingSpace.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
).data
|
||||
if not living_space:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="Living space not found",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
|
||||
occupant_type = OccupantTypes.filter_by_one(
|
||||
occupant_category_type="PRJ",
|
||||
occupant_code="PRJ-LDR",
|
||||
id=living_space.occupant_type,
|
||||
id=living_space.occupant_type
|
||||
).data
|
||||
if not occupant_type:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message=f"{token_dict.selected_occupant.occupant_type_uu_id} occupant type is not allowed, only PRJ-LDR occupant type is allowed",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
decision_book_project_person = BuildDecisionBookProjectPerson.filter_one(
|
||||
BuildDecisionBookProjectPerson.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjectPerson.build_decision_book_project_uu_id == data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjectPerson.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
status_code="HTTP_200_OK",
|
||||
|
|
@ -135,63 +128,62 @@ class ProjectDecisionBookUpdateEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_update(
|
||||
cls,
|
||||
data: UpdateBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: UpdateBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
living_space = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.id == token_dict.selected_occupant.living_space_id,
|
||||
BuildLivingSpace.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
).data
|
||||
if not living_space:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="Living space not found",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
|
||||
occupant_type = OccupantTypes.filter_by_one(
|
||||
occupant_category_type="PRJ",
|
||||
occupant_code="PRJ-LDR",
|
||||
id=living_space.occupant_type,
|
||||
id=living_space.occupant_type
|
||||
).data
|
||||
if not occupant_type:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message=f"{token_dict.selected_occupant.occupant_type_uu_id} occupant type is not allowed, only PRJ-LDR occupant type is allowed",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
|
||||
decision_book_project_person = BuildDecisionBookProjectPerson.filter_one(
|
||||
BuildDecisionBookProjectPerson.build_decision_book_project_uu_id
|
||||
== data.build_decision_book_project_uu_id,
|
||||
BuildDecisionBookProjectPerson.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id == data.get("build_decision_book_project_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
).data
|
||||
if not decision_book_project_person:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="This project is not allowed for this occupant",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
decision_book_project = BuildDecisionBookProjects.filter_one(
|
||||
BuildDecisionBookProjects.id
|
||||
== decision_book_project_person.build_decision_book_project_id,
|
||||
BuildDecisionBookProjects.id == decision_book_project_person.build_decision_book_project_id,
|
||||
)
|
||||
if decision_book_project.is_completed:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Project decision book is closed. No modification is allowed",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
data_dict = data.excluded_dump()
|
||||
decision_book_project.update(**data_dict)
|
||||
|
|
@ -212,67 +204,66 @@ class ProjectDecisionBookApprovalEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_approval(
|
||||
cls,
|
||||
data: ApprovalsBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: ApprovalsBuildDecisionBookProjects,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
living_space = BuildLivingSpace.filter_one(
|
||||
BuildLivingSpace.id == token_dict.selected_occupant.living_space_id,
|
||||
BuildLivingSpace.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
).data
|
||||
if not living_space:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="Living space not found",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
occupant_type = OccupantTypes.filter_by_one(
|
||||
system=True,
|
||||
occupant_category_type="PRJ",
|
||||
occupant_code="PRJ-LDR",
|
||||
id=living_space.occupant_type,
|
||||
id=living_space.occupant_type
|
||||
).data
|
||||
if not occupant_type:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message=f"{token_dict.selected_occupant.occupant_type_uu_id} occupant type is not allowed, only PRJ-LDR occupant type is allowed",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
|
||||
decision_book_project_person = BuildDecisionBookProjectPerson.filter_one(
|
||||
BuildDecisionBookProjectPerson.build_decision_book_project_uu_id
|
||||
== data.build_decision_book_project_uu_id,
|
||||
BuildDecisionBookProjectPerson.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id == data.get(
|
||||
"build_decision_book_project_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
).data
|
||||
if not decision_book_project_person:
|
||||
raise BuildDecisionBookProjectPerson.raise_http_exception(
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message="This project is not allowed for this occupant",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
decision_book_project = BuildDecisionBookProjects.filter_one(
|
||||
BuildDecisionBookProjects.id
|
||||
== decision_book_project_person.build_decision_book_project_id,
|
||||
BuildDecisionBookProjects.id == decision_book_project_person.build_decision_book_project_id,
|
||||
).data
|
||||
if decision_book_project.is_completed:
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Project decision book is closed. No modification is allowed",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
data_dict = data.excluded_dump()
|
||||
data_dict["is_completed"] = True
|
||||
data_dict["status_id"] = 1 # is completed status
|
||||
|
||||
build_parts_list = BuildParts.filter_all(
|
||||
BuildParts.human_livable == True,
|
||||
|
|
@ -280,21 +271,19 @@ class ProjectDecisionBookApprovalEventMethods(MethodToEvent):
|
|||
).data
|
||||
|
||||
decision_book_project_item = BuildDecisionBookItems.filter_one(
|
||||
BuildDecisionBookItems.id
|
||||
== decision_book_project.build_decision_book_item_id
|
||||
BuildDecisionBookItems.id == decision_book_project.build_decision_book_item_id
|
||||
).data
|
||||
|
||||
book_payment_dict = dict(
|
||||
payment_plan_time_periods=str(),
|
||||
build_decision_book_item_id=decision_book_project_item.id,
|
||||
build_decision_book_item_uu_id=str(decision_book_project_item.uu_id),
|
||||
currency=decision_book_project.currency,
|
||||
)
|
||||
payment_type = ApiEnumDropdown.get_debit_search(search_debit="DT-D")
|
||||
for final_price in data.final_price_list or []:
|
||||
for final_price in data.final_price_list:
|
||||
for build_part_single in build_parts_list:
|
||||
local_date = BuildDecisionBookPayments.client_arrow.get(
|
||||
str(final_price["date"])
|
||||
)
|
||||
local_date = BuildDecisionBookPayments.client_arrow.get(str(final_price["date"]))
|
||||
local_date = system_arrow.get(local_date)
|
||||
payment_amount = abs(float(final_price["price"])) * -1
|
||||
created_book_payment = BuildDecisionBookPayments.find_or_create(
|
||||
|
|
@ -331,25 +320,36 @@ class ProjectDecisionBookPatchEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_patch(
|
||||
cls,
|
||||
data,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
return
|
||||
|
||||
|
||||
ProjectDecisionBookListEventMethod = ProjectDecisionBookListEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/list")
|
||||
ProjectDecisionBookListEventMethod = (
|
||||
ProjectDecisionBookListEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/person/list")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookCreateEventMethod = ProjectDecisionBookCreateEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/create")
|
||||
ProjectDecisionBookCreateEventMethod = (
|
||||
ProjectDecisionBookCreateEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/create")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookUpdateEventMethod = ProjectDecisionBookUpdateEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/update")
|
||||
ProjectDecisionBookUpdateEventMethod = (
|
||||
ProjectDecisionBookUpdateEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/update")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookApprovalEventMethod = ProjectDecisionBookApprovalEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/approval")
|
||||
ProjectDecisionBookApprovalEventMethod = (
|
||||
ProjectDecisionBookApprovalEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/approval")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookPatchEventMethod = ProjectDecisionBookPatchEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/patch")
|
||||
ProjectDecisionBookPatchEventMethod = (
|
||||
ProjectDecisionBookPatchEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/patch")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ from api_validations.validations_request import (
|
|||
from api_events.events.abstract_class import MethodToEvent, ActionsSchema
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from api_validations.core_response import AlchemyJsonResponse
|
||||
from databases.sql_models.building.decision_book import BuildDecisionBookProjects
|
||||
|
||||
|
||||
class BuildDecisionBookProjectItemsListEventMethods(MethodToEvent):
|
||||
|
|
@ -48,36 +47,17 @@ class BuildDecisionBookProjectItemsCreateEventMethods(MethodToEvent):
|
|||
|
||||
@staticmethod
|
||||
def build_decision_book_project_items_create(
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
data: InsertBuildDecisionBookProjectItems,
|
||||
requester: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
decision_book_project_items: InsertBuildDecisionBookProjectItems,
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjectItems.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="UNAUTHORIZED",
|
||||
message=f"No permission to create decision book project items",
|
||||
data={},
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
book_project = BuildDecisionBookProjects.filter_one(
|
||||
BuildDecisionBookProjects.uu_id == data.build_decision_book_project_uu_id,
|
||||
BuildDecisionBookProjects.project_response_living_space_id == token_dict.selected_occupant.living_space_id
|
||||
).data
|
||||
if not book_project:
|
||||
raise BuildDecisionBookProjectItems.raise_http_exception(
|
||||
status_code="HTTP_404_NOT_FOUND",
|
||||
error_case="NOT_FOUND",
|
||||
message=f"This user can not create project item for this project uu_id : {data.build_decision_book_project_uu_id}",
|
||||
data={},
|
||||
)
|
||||
data_dict = data.excluded_dump()
|
||||
data_dict["build_decision_book_project_id"] = book_project.id
|
||||
created_project_item = BuildDecisionBookProjectItems.find_or_create(**data_dict)
|
||||
created_project_item.save_and_confirm()
|
||||
return AlchemyJsonResponse(
|
||||
message="Build Decision Book Project Items Create",
|
||||
result=created_project_item.get_dict(),
|
||||
)
|
||||
response = BuildDecisionBookProjectItems.create_item(
|
||||
requester=requester,
|
||||
decision_book_project_items=decision_book_project_items,
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
message="Build Decision Book Project Items Create",
|
||||
result=response,
|
||||
)
|
||||
|
||||
|
||||
class BuildDecisionBookProjectItemsUpdateEventMethods(MethodToEvent):
|
||||
|
|
@ -96,7 +76,7 @@ class BuildDecisionBookProjectItemsUpdateEventMethods(MethodToEvent):
|
|||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="UNAUTHORIZED",
|
||||
message=f"No permission to update decision book project items",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,33 +26,28 @@ class ProjectDecisionBookPersonListEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_person_list(
|
||||
cls,
|
||||
list_options: ListOptions,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: ListOptions,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
project_person = BuildDecisionBookProjectPerson.filter_all(
|
||||
BuildDecisionBookProjects.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
decision_book_ids = [
|
||||
_.build_decision_book_project_id for _ in project_person.data
|
||||
]
|
||||
decision_book_ids = [_.build_decision_book_project_id for _ in project_person.data]
|
||||
decision_book_projects = BuildDecisionBookProjects.filter_all(
|
||||
BuildDecisionBookProjects.build_decision_book_project_id.in_(
|
||||
decision_book_ids
|
||||
),
|
||||
BuildDecisionBookProjects.build_decision_book_project_id.in_(decision_book_ids),
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
status_code="HTTP_200_OK",
|
||||
message="Project decision person book listed successfully",
|
||||
message="Project decision book created successfully",
|
||||
result=decision_book_projects,
|
||||
)
|
||||
|
||||
|
|
@ -67,23 +62,21 @@ class ProjectDecisionBookPersonCreateEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_create(
|
||||
cls,
|
||||
data: InsertBuildDecisionBookProjectPerson,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: InsertBuildDecisionBookProjectPerson,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
decision_book = BuildDecisionBookProjects.filter_one(
|
||||
BuildDecisionBookProjects.build_decision_book_uu_id
|
||||
== data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.project_response_living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.build_decision_book_uu_id==data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.project_response_living_space_id==token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
status_code="HTTP_200_OK",
|
||||
|
|
@ -102,23 +95,21 @@ class ProjectDecisionBookPersonUpdateEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_update(
|
||||
cls,
|
||||
data: UpdateBuildDecisionBookProjectPerson,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data: UpdateBuildDecisionBookProjectPerson,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
decision_book_project_person = BuildDecisionBookProjectPerson.filter_one(
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id
|
||||
== data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id == data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
|
||||
return AlchemyJsonResponse(
|
||||
|
|
@ -138,23 +129,21 @@ class ProjectDecisionBookPersonPatchEventMethods(MethodToEvent):
|
|||
|
||||
@classmethod
|
||||
def project_decision_book_patch(
|
||||
cls,
|
||||
data,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
cls,
|
||||
data,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
if isinstance(token_dict, EmployeeTokenObject):
|
||||
raise BuildDecisionBookProjects.raise_http_exception(
|
||||
status_code="HTTP_403_FORBIDDEN",
|
||||
error_case="NOT_ALLOWED",
|
||||
message="Employee cannot create project project decision book",
|
||||
data={},
|
||||
data={}
|
||||
)
|
||||
elif isinstance(token_dict, OccupantTokenObject):
|
||||
decision_book_project_person = BuildDecisionBookProjectPerson.filter_one(
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id
|
||||
== data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id
|
||||
== token_dict.selected_occupant.living_space_id,
|
||||
BuildDecisionBookProjects.build_decision_book_project_uu_id == data.get("build_decision_book_uu_id"),
|
||||
BuildDecisionBookProjects.living_space_id == token_dict.selected_occupant.living_space_id,
|
||||
)
|
||||
return AlchemyJsonResponse(
|
||||
status_code="HTTP_200_OK",
|
||||
|
|
@ -163,8 +152,10 @@ class ProjectDecisionBookPersonPatchEventMethods(MethodToEvent):
|
|||
)
|
||||
|
||||
|
||||
ProjectDecisionBookPersonListEventMethod = ProjectDecisionBookPersonListEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/people/list")
|
||||
ProjectDecisionBookPersonListEventMethod = (
|
||||
ProjectDecisionBookPersonListEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/people/list")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookPersonCreateEventMethod = (
|
||||
ProjectDecisionBookPersonCreateEventMethods(
|
||||
|
|
@ -176,6 +167,8 @@ ProjectDecisionBookPersonUpdateEventMethod = (
|
|||
action=ActionsSchema(endpoint="/build/decision_book/project/people/update")
|
||||
)
|
||||
)
|
||||
ProjectDecisionBookPersonPatchEventMethod = ProjectDecisionBookPersonPatchEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/people/patch")
|
||||
ProjectDecisionBookPersonPatchEventMethod = (
|
||||
ProjectDecisionBookPersonPatchEventMethods(
|
||||
action=ActionsSchema(endpoint="/build/decision_book/project/people/patch")
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,15 +17,6 @@ from api_events.tasks2events.occupant_tasks.meeting_president import (
|
|||
from api_events.tasks2events.occupant_tasks.meeting_voted_president import (
|
||||
BuildMeetingVotedPresident,
|
||||
)
|
||||
from api_events.tasks2events.occupant_tasks.project_leader import ProjectLeader
|
||||
from api_events.tasks2events.occupant_tasks.project_finance import (
|
||||
ProjectFinanceResponsible,
|
||||
)
|
||||
from api_events.tasks2events.occupant_tasks.project_employee import ProjectEmployee
|
||||
from api_events.tasks2events.occupant_tasks.project_technical import ProjectTechnical
|
||||
from api_events.tasks2events.occupant_tasks.project_responsiable import (
|
||||
ProjectResponsible,
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -41,9 +32,4 @@ __all__ = [
|
|||
"BuildMeetingAdvisor",
|
||||
"BuildMeetingAttendance",
|
||||
"BuildMeetingVotedPresident",
|
||||
"ProjectLeader",
|
||||
"ProjectFinanceResponsible",
|
||||
"ProjectEmployee",
|
||||
"ProjectTechnical",
|
||||
"ProjectResponsible",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class ProjectEmployee(AddEventFunctionality):
|
|||
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||
|
||||
]
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class ProjectFinanceResponsible(AddEventFunctionality):
|
|||
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||
|
||||
]
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class ProjectLeader(AddEventFunctionality):
|
|||
{"function_code": "7fbd18a0-c099-4494-ada1-bb23e39bb141"},
|
||||
{"function_code": "a122e84a-5556-4bf7-b680-1f47c438d4f7"},
|
||||
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||
]
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class UpdateBuildDecisionBookProjectPerson(PydanticBaseModel):
|
|||
|
||||
class InsertBuildDecisionBookProjects(BaseModelRegular):
|
||||
build_decision_book_item_uu_id: str
|
||||
project_responsible_person_uu_id: str
|
||||
project_response_person_uu_id: str
|
||||
project_name: str
|
||||
project_start_date: str
|
||||
project_stop_date: str
|
||||
|
|
@ -77,9 +77,8 @@ class UpdateBuildDecisionBookProjects(PydanticBaseModel):
|
|||
|
||||
class ApprovalsBuildDecisionBookProjects(PydanticBaseModel):
|
||||
build_decision_book_project_uu_id: str
|
||||
final_price_list: list[dict] # {"date": "2021-01-01", "price": 1000}
|
||||
project_stop_date: str
|
||||
status_code: Optional[int] = None
|
||||
final_price_list: Optional[list[dict]] = None # {"date": "2021-01-01", "price": 1000}
|
||||
|
||||
|
||||
class InsertBuildDecisionBookProjectItemDebits(PydanticBaseModel):
|
||||
|
|
|
|||
|
|
@ -6,14 +6,6 @@ from databases.sql_models.account.account import (
|
|||
AccountCodes,
|
||||
AccountDetail,
|
||||
AccountMaster,
|
||||
AccountRecordDecisionPaymentClosed,
|
||||
AccountRecordExchanges,
|
||||
)
|
||||
from databases.sql_models.building.budget import (
|
||||
DecisionBookBudgetBooks,
|
||||
DecisionBookBudgetCodes,
|
||||
DecisionBookBudgetMaster,
|
||||
DecisionBookBudgets,
|
||||
)
|
||||
from databases.sql_models.account.iban import (
|
||||
BuildIbans,
|
||||
|
|
@ -108,8 +100,6 @@ __all__ = [
|
|||
"AccountCodes",
|
||||
"AccountDetail",
|
||||
"AccountMaster",
|
||||
"AccountRecordDecisionPaymentClosed",
|
||||
"AccountRecordExchanges",
|
||||
"BuildIbans",
|
||||
"BuildIbanDescription",
|
||||
"CrypterEngine",
|
||||
|
|
@ -132,10 +122,6 @@ __all__ = [
|
|||
"BuildDecisionBookProjectPerson",
|
||||
"BuildDecisionBookPersonOccupants",
|
||||
"BuildDecisionBookProjectItems",
|
||||
"DecisionBookBudgetBooks",
|
||||
"DecisionBookBudgetCodes",
|
||||
"DecisionBookBudgetMaster",
|
||||
"DecisionBookBudgets",
|
||||
"Companies",
|
||||
"RelationshipDutyCompany",
|
||||
"Employees",
|
||||
|
|
|
|||
|
|
@ -650,99 +650,3 @@ class AccountRecords(CrudCollection):
|
|||
# )
|
||||
# )
|
||||
# print("is all dues_type", payment_dict["dues_type"], paid_value)
|
||||
|
||||
|
||||
class AccountRecordDecisionPaymentClosed(CrudCollection):
|
||||
|
||||
__tablename__ = "account_record_decision_payment_closed"
|
||||
__exclude__fields__ = []
|
||||
|
||||
arc_currency: Mapped[str] = mapped_column(
|
||||
String(5), nullable=False, comment="Unit of Currency"
|
||||
)
|
||||
arc_processing_time: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, nullable=False, comment="Processing Time"
|
||||
)
|
||||
arc_currency_value: Mapped[float] = mapped_column(
|
||||
Numeric(20, 6), nullable=False, comment="Currency Value"
|
||||
)
|
||||
|
||||
decision_book_budgets_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("decision_book_budgets.id"), nullable=True
|
||||
)
|
||||
decision_book_budgets_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Budget UUID"
|
||||
)
|
||||
|
||||
build_decision_book_payment_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_decision_book_payments.id")
|
||||
)
|
||||
build_decision_book_payment_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Decision Book Payment UU ID"
|
||||
)
|
||||
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
|
||||
account_records_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Account Record UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"_account_record_decision_payment_closed_ndx_00",
|
||||
account_records_id,
|
||||
build_decision_book_payment_id,
|
||||
arc_processing_time,
|
||||
),
|
||||
Index(
|
||||
"_account_record_decision_payment_closed_ndx_01",
|
||||
build_decision_book_payment_id,
|
||||
account_records_id,
|
||||
arc_processing_time,
|
||||
),
|
||||
{"comment": "Account Record Decision Payment Closed Information"},
|
||||
)
|
||||
|
||||
|
||||
class AccountRecordExchanges(CrudCollection):
|
||||
__tablename__ = "account_record_exchanges"
|
||||
__exclude__fields__ = []
|
||||
|
||||
are_currency: Mapped[str] = mapped_column(
|
||||
String(5), nullable=False, comment="Unit of Currency"
|
||||
)
|
||||
are_exchange_rate: Mapped[float] = mapped_column(
|
||||
Numeric(18, 6), nullable=False, server_default="1"
|
||||
)
|
||||
usd_exchange_rate_value: Mapped[float] = mapped_column(
|
||||
Numeric(18, 6),
|
||||
nullable=True,
|
||||
server_default="0",
|
||||
comment="It will be written by multiplying the usd exchange rate with the current value result.",
|
||||
)
|
||||
eur_exchange_rate_value: Mapped[float] = mapped_column(
|
||||
Numeric(18, 6),
|
||||
nullable=True,
|
||||
server_default="0",
|
||||
comment="It will be written by multiplying the eur exchange rate with the current value result.",
|
||||
)
|
||||
gbp_exchange_rate_value: Mapped[float] = mapped_column(
|
||||
Numeric(18, 6),
|
||||
nullable=True,
|
||||
server_default="0",
|
||||
comment="It will be written by multiplying the gpd exchange rate with the current value result.",
|
||||
)
|
||||
cny_exchange_rate_value: Mapped[float] = mapped_column(
|
||||
Numeric(18, 6),
|
||||
nullable=True,
|
||||
server_default="0",
|
||||
comment="It will be written by multiplying the cny exchange rate with the current value result.",
|
||||
)
|
||||
|
||||
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
|
||||
account_records_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Account Record UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("_account_record_exchanges_ndx_00", account_records_id),
|
||||
{"comment": "Account Record Exchanges Information"},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,157 +0,0 @@
|
|||
from sqlalchemy import (
|
||||
String,
|
||||
ForeignKey,
|
||||
Index,
|
||||
SmallInteger,
|
||||
Boolean,
|
||||
TIMESTAMP,
|
||||
Text,
|
||||
Numeric,
|
||||
Integer,
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, Mapped, relationship
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
|
||||
|
||||
class DecisionBookBudgetBooks(CrudCollection):
|
||||
|
||||
__tablename__ = "decision_book_budget_books"
|
||||
__exclude__fields__ = []
|
||||
|
||||
country: Mapped[str] = mapped_column(String, nullable=False)
|
||||
branch_type: Mapped[int] = mapped_column(SmallInteger, server_default="0")
|
||||
|
||||
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=False)
|
||||
company_uu_id: Mapped[str] = mapped_column(String, nullable=False)
|
||||
branch_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
|
||||
branch_uu_id: Mapped[str] = mapped_column(
|
||||
String, comment="Branch UU ID", nullable=True
|
||||
)
|
||||
build_decision_book_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=False
|
||||
)
|
||||
build_decision_book_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Decision Book UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"_decision_book_budget_companies_book_ndx_00",
|
||||
company_id,
|
||||
CrudCollection.created_at,
|
||||
),
|
||||
{"comment": "budget Book Information"},
|
||||
)
|
||||
|
||||
|
||||
class DecisionBookBudgetCodes(CrudCollection):
|
||||
|
||||
__tablename__ = "decision_book_budget_codes"
|
||||
__exclude__fields__ = []
|
||||
|
||||
budget_code: Mapped[str] = mapped_column(
|
||||
String(48), nullable=False, comment="budget Code"
|
||||
)
|
||||
comment_line: Mapped[str] = mapped_column(
|
||||
Text, nullable=False, comment="Comment Line"
|
||||
)
|
||||
|
||||
build_decision_book_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_decision_book.id"), nullable=True
|
||||
)
|
||||
build_decision_book_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Decision Book UU ID"
|
||||
)
|
||||
|
||||
build_parts_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("build_parts.id"), nullable=True
|
||||
)
|
||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Build Parts UU ID"
|
||||
)
|
||||
|
||||
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
|
||||
company_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Company UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index("_decision_book_budget_codes_ndx_00", budget_code, "created_at"),
|
||||
Index("_decision_book_budget_codes_ndx_01", company_id, "created_at"),
|
||||
{"comment": "budget Book Information"},
|
||||
)
|
||||
|
||||
|
||||
class DecisionBookBudgetMaster(CrudCollection):
|
||||
|
||||
__tablename__ = "decision_book_budget_master"
|
||||
__exclude__fields__ = []
|
||||
|
||||
budget_type: Mapped[str] = mapped_column(
|
||||
String(50), nullable=False
|
||||
) # Bütçe tipi (örneğin: Operasyonel, Yatırım)
|
||||
currency: Mapped[str] = mapped_column(
|
||||
String(8), server_default="TRY"
|
||||
) # Bütçe para birimi
|
||||
total_budget: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), nullable=False
|
||||
) # Toplam bütçe
|
||||
|
||||
tracking_period_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
)
|
||||
tracking_period_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Part Direction UUID"
|
||||
)
|
||||
budget_books_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("decision_book_budget_books.id"), nullable=False
|
||||
)
|
||||
budget_books_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Budget Books UU ID"
|
||||
)
|
||||
department_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("departments.id"), nullable=False
|
||||
) # Departman ile ilişki
|
||||
department_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Department UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = ({"comment": "budget Book Information"},)
|
||||
|
||||
|
||||
class DecisionBookBudgets(CrudCollection):
|
||||
|
||||
__tablename__ = "decision_book_budgets"
|
||||
__exclude__fields__ = []
|
||||
|
||||
process_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, nullable=False
|
||||
) # Başlangıç tarihi
|
||||
budget_codes_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("decision_book_budget_codes.id"), nullable=False
|
||||
)
|
||||
total_budget: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), nullable=False
|
||||
) # Toplam bütçe
|
||||
used_budget: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), nullable=False, default=0.0
|
||||
) # Kullanılan bütçe
|
||||
remaining_budget: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), nullable=False, default=0.0
|
||||
) # Kullanılan bütçe
|
||||
|
||||
decision_book_budget_master_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("decision_book_budget_master.id"), nullable=False
|
||||
)
|
||||
decision_book_budget_master_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Decision Book Budget Master UU ID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
Index(
|
||||
"_decision_book_budgets_ndx_00",
|
||||
decision_book_budget_master_uu_id,
|
||||
process_date,
|
||||
),
|
||||
{"comment": "budget Book Information"},
|
||||
)
|
||||
|
|
@ -549,7 +549,6 @@ class BuildLivingSpace(CrudCollection):
|
|||
occupant_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=False, comment="Occupant Type UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
{"comment": "Living Space inside building parts that are related to people"},
|
||||
)
|
||||
|
|
@ -575,6 +574,7 @@ class BuildLivingSpace(CrudCollection):
|
|||
).data
|
||||
related_service = Services.filter_by_one(
|
||||
related_responsibility=occupant_type.occupant_code,
|
||||
**Services.valid_record_dict,
|
||||
).data
|
||||
|
||||
created_living_space.save_and_confirm()
|
||||
|
|
|
|||
|
|
@ -883,14 +883,14 @@ class BuildDecisionBookPayments(CrudCollection):
|
|||
String, nullable=False, comment="Build Part UUID"
|
||||
)
|
||||
|
||||
# budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
|
||||
# budget_records_uu_id: Mapped[str] = mapped_column(
|
||||
# String, nullable=True, comment="Budget UUID"
|
||||
# )
|
||||
# accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
|
||||
# accounting_uu_id: Mapped[str] = mapped_column(
|
||||
# String, nullable=True, comment="Accounting UUID"
|
||||
# )
|
||||
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
|
||||
budget_records_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Budget UUID"
|
||||
)
|
||||
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
|
||||
accounting_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Accounting UUID"
|
||||
)
|
||||
# receive_debit_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
|
||||
# receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UUID")
|
||||
|
||||
|
|
@ -920,6 +920,11 @@ class BuildDecisionBookPayments(CrudCollection):
|
|||
process_date,
|
||||
unique=True,
|
||||
),
|
||||
Index(
|
||||
"build_decision_book_payments_detail_ndx_01",
|
||||
budget_records_id,
|
||||
process_date,
|
||||
),
|
||||
{"comment": "Payment Details of Decision Book Payments"},
|
||||
)
|
||||
|
||||
|
|
@ -1018,6 +1023,7 @@ class BuildDecisionBookProjects(CrudCollection):
|
|||
project_start_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, nullable=False, comment="Project Start Date"
|
||||
)
|
||||
|
||||
project_stop_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, server_default="2099-12-31 23:59:59"
|
||||
)
|
||||
|
|
@ -1030,7 +1036,7 @@ class BuildDecisionBookProjects(CrudCollection):
|
|||
is_completed: Mapped[bool] = mapped_column(
|
||||
Boolean, server_default="0", comment="Project is Completed"
|
||||
)
|
||||
status_code: Mapped[int] = mapped_column(SmallInteger, nullable=True)
|
||||
status_id: Mapped[int] = mapped_column(SmallInteger, nullable=True)
|
||||
resp_company_fix_wage: Mapped[float] = mapped_column(
|
||||
Numeric(10, 2), server_default="0"
|
||||
)
|
||||
|
|
@ -1039,7 +1045,7 @@ class BuildDecisionBookProjects(CrudCollection):
|
|||
meeting_date: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP, server_default="1900-01-01 00:00:00", index=True
|
||||
)
|
||||
currency: Mapped[str] = mapped_column(String(8), server_default="TRY")
|
||||
currency: Mapped[float] = mapped_column(String(8), server_default="TRY")
|
||||
bid_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
approved_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
final_price: Mapped[float] = mapped_column(Numeric(16, 4), server_default="0")
|
||||
|
|
@ -1056,7 +1062,7 @@ class BuildDecisionBookProjects(CrudCollection):
|
|||
build_decision_book_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Decision Book UUID"
|
||||
)
|
||||
build_decision_book_item_id: Mapped[int] = mapped_column(
|
||||
build_decision_book_item_id = mapped_column(
|
||||
ForeignKey("build_decision_book_items.id"), nullable=False
|
||||
)
|
||||
build_decision_book_item_uu_id: Mapped[str] = mapped_column(
|
||||
|
|
@ -1195,6 +1201,13 @@ class BuildDecisionBookProjectPerson(CrudCollection):
|
|||
String, nullable=True, comment="Living Space UUID"
|
||||
)
|
||||
|
||||
project_team_type_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("api_enum_dropdown.id"), nullable=True
|
||||
)
|
||||
project_team_type_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Management Type UUID"
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
{"comment": "People that are attended to building project meetings."},
|
||||
)
|
||||
|
|
@ -1232,7 +1245,6 @@ class BuildDecisionBookProjectItems(CrudCollection):
|
|||
{"comment": "Project Items related to decision taken at building meetings"},
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# class BuildDecisionBookPaymentsMaster(CrudCollection):
|
||||
# """
|
||||
|
|
|
|||
|
|
@ -50,15 +50,6 @@ from .application.occupants.router import occupant_types_route
|
|||
from .decision_book.decision_book_invitations.router import (
|
||||
build_decision_book_invitations,
|
||||
)
|
||||
from .decision_book.project_decision_book.router import (
|
||||
build_decision_book_project_route,
|
||||
)
|
||||
from .decision_book.project_decision_book_items.router import (
|
||||
build_decision_book_project_items_route,
|
||||
)
|
||||
from .decision_book.project_decision_book_person.router import (
|
||||
build_decision_book_project_people_route,
|
||||
)
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -96,7 +87,4 @@ __all__ = [
|
|||
"build_project_decision_book_person_route",
|
||||
"endpoint_restriction_route",
|
||||
"build_decision_book_invitations",
|
||||
"build_decision_book_project_route",
|
||||
"build_decision_book_project_items_route",
|
||||
"build_decision_book_project_people_route",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ build_decision_book_project_route.include_router(
|
|||
@build_decision_book_project_route.post(
|
||||
path="/list", summary="List Active/Delete/Confirm Build Decision Book People"
|
||||
)
|
||||
def build_decision_book_project_people_list(
|
||||
request: Request, list_options: ListOptions
|
||||
):
|
||||
def build_decision_book_project_people_list(request: Request, list_options: ListOptions):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
|
||||
|
||||
|
|
@ -32,9 +30,7 @@ def build_decision_book_project_people_list(
|
|||
path="/create",
|
||||
summary="Create Build Decision Book Project People with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_create(
|
||||
request: Request, data: InsertBuildDecisionBookProjects
|
||||
):
|
||||
def build_decision_book_project_people_create(request: Request, data: InsertBuildDecisionBookProjects):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(data=data, token_dict=token_dict)
|
||||
|
||||
|
|
@ -43,15 +39,13 @@ def build_decision_book_project_people_create(
|
|||
path="/update/{build_decision_book_project_id}",
|
||||
summary="Add people to Build Decision People Book with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_update(
|
||||
request: Request, data: UpdateBuildDecisionBookProjects
|
||||
):
|
||||
def build_decision_book_project_people_update(request: Request, data: UpdateBuildDecisionBookProjects):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(data=data, token_dict=token_dict)
|
||||
|
||||
|
||||
@build_decision_book_project_route.post(
|
||||
path="/approval",
|
||||
path="/approval/{build_decision_book_project_id}",
|
||||
summary="Approval people from Build Decision Book Project People with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_invite_approval(
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ from api_services.redis.auth_actions.token import parse_token_object_to_dict
|
|||
|
||||
|
||||
build_decision_book_project_items_route = APIRouter(
|
||||
prefix="/build/decision_book/project/items",
|
||||
tags=["Decision Project Book Project Items"],
|
||||
prefix="/build/decision_book/project/items", tags=["Decision Project Book Project Items"]
|
||||
)
|
||||
build_decision_book_project_items_route.include_router(
|
||||
build_decision_book_project_items_route, include_in_schema=True
|
||||
|
|
@ -19,12 +18,9 @@ build_decision_book_project_items_route.include_router(
|
|||
|
||||
|
||||
@build_decision_book_project_items_route.post(
|
||||
path="/list",
|
||||
summary="List Active/Delete/Confirm Decision Project Book Project Items",
|
||||
path="/list", summary="List Active/Delete/Confirm Decision Project Book Project Items"
|
||||
)
|
||||
def build_decision_book_project_people_items_list(
|
||||
request: Request, list_options: ListOptions
|
||||
):
|
||||
def build_decision_book_project_people_items_list(request: Request, list_options: ListOptions):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
|
||||
|
||||
|
|
@ -33,9 +29,7 @@ def build_decision_book_project_people_items_list(
|
|||
path="/create",
|
||||
summary="Create Build Decision Book Project People with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_items_create(
|
||||
request: Request, data: InsertBuildDecisionBookProjectItems
|
||||
):
|
||||
def build_decision_book_project_people_items_create(request: Request, data: InsertBuildDecisionBookProjectItems):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(data=data, token_dict=token_dict)
|
||||
|
||||
|
|
@ -45,15 +39,15 @@ def build_decision_book_project_people_items_create(
|
|||
summary="Add people to Decision Project Book Project Items with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_items_update(
|
||||
request: Request,
|
||||
build_decision_book_project_item_uu_id: str,
|
||||
data: UpdateBuildDecisionBookProjectItems,
|
||||
request: Request,
|
||||
build_decision_book_project_item_uu_id: str,
|
||||
data: UpdateBuildDecisionBookProjectItems
|
||||
):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(
|
||||
data=data,
|
||||
build_decision_book_project_item_uu_id=build_decision_book_project_item_uu_id,
|
||||
token_dict=token_dict,
|
||||
token_dict=token_dict
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -62,11 +56,11 @@ def build_decision_book_project_people_items_update(
|
|||
summary="Patch people from Decision Project Book Project Items with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_items_patch(
|
||||
request: Request, build_decision_book_project_item_uu_id: str, data
|
||||
request: Request, build_decision_book_project_item_uu_id:str, data
|
||||
):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(
|
||||
data=data,
|
||||
build_decision_book_project_item_uu_id=build_decision_book_project_item_uu_id,
|
||||
token_dict=token_dict,
|
||||
token_dict=token_dict
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ build_decision_book_project_people_route.include_router(
|
|||
@build_decision_book_project_people_route.post(
|
||||
path="/list", summary="List Active/Delete/Confirm Build Decision Book People"
|
||||
)
|
||||
def build_decision_book_project_people_list(
|
||||
request: Request, list_options: ListOptions
|
||||
):
|
||||
def build_decision_book_project_people_list(request: Request, list_options: ListOptions):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
|
||||
|
||||
|
|
@ -31,9 +29,7 @@ def build_decision_book_project_people_list(
|
|||
path="/create",
|
||||
summary="Create Build Decision Book Project People with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_create(
|
||||
request: Request, data: InsertBuildDecisionBookProjectPerson
|
||||
):
|
||||
def build_decision_book_project_people_create(request: Request, data: InsertBuildDecisionBookProjectPerson):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(data=data, token_dict=token_dict)
|
||||
|
||||
|
|
@ -43,15 +39,13 @@ def build_decision_book_project_people_create(
|
|||
summary="Add people to Build Decision People Book with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_update(
|
||||
request: Request,
|
||||
build_decision_book_project_person_uu_id: str,
|
||||
data: UpdateBuildDecisionBookProjectPerson,
|
||||
request: Request, build_decision_book_project_person_uu_id:str, data: UpdateBuildDecisionBookProjectPerson
|
||||
):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(
|
||||
data=data,
|
||||
build_decision_book_project_person_uu_id=build_decision_book_project_person_uu_id,
|
||||
token_dict=token_dict,
|
||||
token_dict=token_dict
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -60,13 +54,11 @@ def build_decision_book_project_people_update(
|
|||
summary="Patch people from Build Decision Book Project People with given auth levels",
|
||||
)
|
||||
def build_decision_book_project_people_patch(
|
||||
request: Request,
|
||||
build_decision_book_project_person_uu_id: str,
|
||||
data: UpdateBuildDecisionBookProjectPerson,
|
||||
request: Request, build_decision_book_project_person_uu_id:str, data: UpdateBuildDecisionBookProjectPerson
|
||||
):
|
||||
token_dict = parse_token_object_to_dict(request=request)
|
||||
return token_dict.available_event(
|
||||
data=data,
|
||||
build_decision_book_project_person_uu_id=build_decision_book_project_person_uu_id,
|
||||
token_dict=token_dict,
|
||||
token_dict=token_dict
|
||||
)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,11 @@ def init_api_enums_build_types():
|
|||
created_build_type.save_and_confirm()
|
||||
|
||||
insert_enums = [
|
||||
{"enum_class": "BuildDuesTypes", "type_code": "BDT-D", "type_name": "Debit"},
|
||||
{
|
||||
"enum_class": "BuildDuesTypes",
|
||||
"type_code": "BDT-D",
|
||||
"type_name": "Debit"
|
||||
},
|
||||
{
|
||||
"enum_class": "BuildDuesTypes",
|
||||
"type_code": "BDT-A",
|
||||
|
|
@ -213,28 +217,7 @@ def init_api_enums_build_types():
|
|||
"type_code": "DT-Z",
|
||||
"type_name": "Zero Balance",
|
||||
},
|
||||
{
|
||||
"enum_class": "TimePeriod",
|
||||
"type_code": "TP-W",
|
||||
"type_name": "Weekly",
|
||||
},
|
||||
{
|
||||
"enum_class": "TimePeriod",
|
||||
"type_code": "TP-M",
|
||||
"type_name": "Monthly",
|
||||
},
|
||||
{
|
||||
"enum_class": "TimePeriod",
|
||||
"type_code": "TP-Q",
|
||||
"type_name": "Quarterly",
|
||||
},
|
||||
{
|
||||
"enum_class": "TimePeriod",
|
||||
"type_code": "TP-Y",
|
||||
"type_name": "Yearly",
|
||||
},
|
||||
]
|
||||
|
||||
for insert_enum in insert_enums:
|
||||
created_api_enum = ApiEnumDropdown.find_or_create(
|
||||
enum_class=insert_enum["enum_class"],
|
||||
|
|
|
|||
|
|
@ -245,7 +245,6 @@ def create_modules_and_services_and_actions():
|
|||
service_name=duty_object.duty_name,
|
||||
service_description=duty_object.duty_description,
|
||||
service_code=f"SRE-{duty_object.duty_code}",
|
||||
related_responsibility=duty_object.duty_code,
|
||||
)
|
||||
created_service.save_and_confirm()
|
||||
|
||||
|
|
@ -256,7 +255,6 @@ def create_modules_and_services_and_actions():
|
|||
service_name=occupant_type.occupant_type,
|
||||
service_description=occupant_type.occupant_description,
|
||||
service_code=f"SRO-{occupant_type.occupant_code}",
|
||||
related_responsibility=occupant_type.occupant_code,
|
||||
)
|
||||
created_service.save_and_confirm()
|
||||
|
||||
|
|
@ -264,6 +262,7 @@ def create_modules_and_services_and_actions():
|
|||
create_services_meeting(module_dict=build_module_module_dict)
|
||||
create_services_building(module_dict=build_module_module_dict)
|
||||
create_services_flat(module_dict=build_module_module_dict)
|
||||
Modules.save()
|
||||
return
|
||||
#
|
||||
# super_admin_module_created=None
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
from api_validations.validations_request import (
|
||||
InsertBuildDecisionBookProjectItems,
|
||||
UpdateBuildDecisionBookProjects,
|
||||
|
|
@ -7,9 +8,7 @@ from api_validations.validations_request import (
|
|||
|
||||
def generate_update_project_item(**kwargs):
|
||||
return {
|
||||
"build_decision_book_project_uu_id": kwargs.get(
|
||||
"build_decision_book_project_uu_id", None
|
||||
),
|
||||
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||
"is_out_sourced": kwargs.get("is_out_sourced", False),
|
||||
"project_note": kwargs.get("project_note", None),
|
||||
# "decision_book_pdf_path": str(kwargs.get("decision_book_pdf_path", None)),
|
||||
|
|
@ -25,28 +24,24 @@ def generate_update_project_item(**kwargs):
|
|||
|
||||
def generate_approval_project_item(**kwargs):
|
||||
return {
|
||||
"build_decision_book_project_uu_id": kwargs.get(
|
||||
"build_decision_book_project_uu_id", None
|
||||
),
|
||||
"final_price_list": kwargs.get("final_price_list", None),
|
||||
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||
"final_price_list": kwargs.get("final_price_list", []),
|
||||
"project_stop_date": kwargs.get("project_stop_date", None),
|
||||
"status_code": kwargs.get("status_code", None),
|
||||
}
|
||||
|
||||
|
||||
def generate_insert_project_item(**kwargs):
|
||||
return {
|
||||
"build_decision_book_project_uu_id": kwargs.get(
|
||||
"build_decision_book_project_uu_id", None
|
||||
),
|
||||
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||
"item_header": kwargs.get("item_header", ""),
|
||||
"item_comment": kwargs.get("item_comment", ""),
|
||||
}
|
||||
|
||||
|
||||
def create_decision_book_project_items(requester, insert_project_item):
|
||||
def create_decision_book_items(requester, insert_project_item):
|
||||
response = requester.post(
|
||||
endpoint="/build/decision_book/project/items/create", data=insert_project_item
|
||||
endpoint="/build/decision_book/project/items/create",
|
||||
data=insert_project_item
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
|
|
@ -55,7 +50,8 @@ def create_decision_book_project_items(requester, insert_project_item):
|
|||
|
||||
def update_decision_book_project(requester, update_project_item):
|
||||
response = requester.post(
|
||||
endpoint="/build/decision_book/project/update", data=update_project_item
|
||||
endpoint="/build/decision_book/project/update",
|
||||
data=update_project_item
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
|
|
@ -63,20 +59,8 @@ def update_decision_book_project(requester, update_project_item):
|
|||
|
||||
def approve_build_decision_book_project_approval(requester, approval_project_item):
|
||||
response = requester.post(
|
||||
endpoint="/build/decision_book/project/approval", data=approval_project_item
|
||||
endpoint="/build/decision_book/project/approval",
|
||||
data=approval_project_item
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
|
||||
|
||||
def list_decision_book_project(requester, project_no):
|
||||
response = requester.post(
|
||||
endpoint="/build/decision_book/project/list",
|
||||
data={"query": {"project_no": project_no}},
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
response_json = response.json()
|
||||
# project = response_json["data"][0]["uu_id"]
|
||||
project = response_json["data"][0]
|
||||
return project
|
||||
|
|
|
|||
|
|
@ -1,25 +1,16 @@
|
|||
import json
|
||||
|
||||
import arrow
|
||||
|
||||
from service_app_test.bases import RequestToApi
|
||||
from service_app_test.api_configs import LocalAPI, BothAPIS
|
||||
from service_app_test.test_application.evyos.decision_book import (
|
||||
run_decision_book_depends,
|
||||
list_decision_books,
|
||||
run_decision_book_depends, list_decision_books,
|
||||
)
|
||||
from service_app_test.test_application.evyos.decision_book_items import (
|
||||
send_invitation_to_building_residents,
|
||||
collect_invitation_to_building_residents,
|
||||
assign_people_to_pre_or_wrt,
|
||||
run_decision_book_items,
|
||||
)
|
||||
from service_app_test.test_application.migrate_old_data.get_occupants_codes import (
|
||||
get_occupants_types,
|
||||
)
|
||||
from service_app_test.test_application.migrate_old_data.get_type_codes import (
|
||||
get_type_codes_key_and_class,
|
||||
assign_people_to_pre_or_wrt, run_decision_book_items,
|
||||
)
|
||||
from service_app_test.test_application.migrate_old_data.get_type_codes import get_type_codes_key_and_class
|
||||
from service_app_test.test_application.migrate_old_data.people import migrate_people
|
||||
from service_app_test.test_application.migrate_old_data.building import (
|
||||
migrate_build,
|
||||
|
|
@ -29,29 +20,9 @@ from service_app_test.test_application.migrate_old_data.company import migrate_c
|
|||
from service_app_test.test_application.migrate_old_data.accounts import (
|
||||
migrate_account_records,
|
||||
)
|
||||
from service_app_test.test_application.migrate_old_data.decision_book_project import (
|
||||
approve_build_decision_book_project_approval,
|
||||
update_decision_book_project,
|
||||
create_decision_book_project_items,
|
||||
generate_insert_project_item,
|
||||
generate_update_project_item,
|
||||
generate_approval_project_item,
|
||||
list_decision_book_project,
|
||||
)
|
||||
|
||||
local_api = RequestToApi()
|
||||
local_api.overwrite_base_url(base_url=LocalAPI.base_url)
|
||||
|
||||
both_apis = BothAPIS()
|
||||
both_apis.local_api = local_api
|
||||
|
||||
|
||||
def decode_as_json_indent(data):
|
||||
return json.dumps(json.loads(json.dumps(data)), indent=2)
|
||||
|
||||
|
||||
password_token = "FGS095it2IBP3gIp5glaG6u9tQy1KEPzKnBYE1fvGJSGvGUhwaGgxE-56yZAxUQnW-a_J91twOFKTWTc0ue4GZq10vY7fK2cZBsR9bUDJMCHZZZGpFYbsE6pLyaDs-1_K8v5hbggSmpXNFfafMmujuXxqvSzdLQa5hcg9qepHBOvgTbL28wGRHx9w-Fcb7bL"
|
||||
password_token_occ = "kM9vHcWZVVF38IyNxMk6XMlCc8FCc_P1D-0D2u-Er5FrcQzvswSjJe9Lu9QnhJ5fJw5WqC45UYxopme_aCX6YDfZfQ3wQ9RP4Ak5YYTWBZbtwKGXTomlpYCQJghy0RC-1-Q9ATNEgcjYXqU2P9UjjdS9JNvhUawT0R38wXap-Mum6oazjqiKow41SUebnZ-H"
|
||||
password_token = "g17Anw5yBvrASMXtES8olfE8vN32R-U7wO_g8kbhjK8C67ww7fv39Mp3ygjouDw8UrwFJhemqFwbEIi2XzIN1u_rq4nmUSROZAnL3NyhczfizMZml0Rd84HWFA80Z1WpIsOadRlGVN77rr3OrrfYXfp1Fa6f_LsiTj0m3N-ie6Mr-4NIQ-3g25Z4oCD4Up6o"
|
||||
login_data = {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||||
|
|
@ -59,36 +30,80 @@ login_data = {
|
|||
"remember_me": False,
|
||||
"password_token": password_token,
|
||||
}
|
||||
login_creds_occupant = {
|
||||
login_creds_employee = {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": "mehmet.karatay@hotmail.com",
|
||||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||||
"password": "string",
|
||||
"remember_me": False,
|
||||
"password_token": password_token_occ,
|
||||
"password_token": password_token,
|
||||
}
|
||||
access_key_president = "mehmet.karatay@hotmail.com"
|
||||
login_creds_occupant = {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": access_key_president,
|
||||
"password": "string",
|
||||
"remember_me": False,
|
||||
"password_token": "88ENxfw1a0tQRHTQ1RWPsv1iWEe2jzwPqra1tH5PuGmr69fneVDdCpQhgj5LnY0L9IA2Zq8eUX7LRpwKaez0rbYQZRdrKNCfx98M4erSNSRCFPI35tBvGdRuTEISIGoUXPI1xEcfQvGT-AOILc-yPOlyfYLyB7Chej1bjuGxe04hdtqQon2rYLmI8KMCv2XK"
|
||||
}
|
||||
wrt_creds_occupant = {
|
||||
"domain": "evyos.com.tr",
|
||||
"access_key": access_key_president,
|
||||
"password": "string",
|
||||
"remember_me": False,
|
||||
"password_token": "",
|
||||
}
|
||||
|
||||
# wag_api = RequestToApi()
|
||||
# wag_api.overwrite_base_url(base_url=WagAPI.base_url)
|
||||
# wag_api.selected_object = wag_api.login_via_email_and_password(
|
||||
# login_data=login_data_wag, is_password_valid=True
|
||||
# )
|
||||
|
||||
local_api = RequestToApi()
|
||||
local_api.overwrite_base_url(base_url=LocalAPI.base_url)
|
||||
|
||||
|
||||
both_apis = BothAPIS()
|
||||
# both_apis.wag_api = wag_api
|
||||
both_apis.local_api = local_api
|
||||
|
||||
assign_people_to_create_item = 3
|
||||
|
||||
# selection_list = None
|
||||
selection_list = [
|
||||
"d9ffa716-331c-48fc-83b2-47bf31289b3e",
|
||||
"afebb7f8-9f62-4703-b11c-ee8f14fe73b7",
|
||||
"68b5e3d9-c546-4ebd-98f5-df468f20cc54",
|
||||
"da2a282c-7053-4cdf-bca5-c41f548883cc",
|
||||
]
|
||||
# selection_list = None
|
||||
manager_token = "jk-8A2kXjk86QGP2WHMrOF7E9UTfzOe0Wcq0HDZFDh78V5YbuNVxmw"
|
||||
writers_token = manager_token
|
||||
people_uu_id_list = [
|
||||
"561a9cbc-587a-4582-8eff-f005f5b1e847",
|
||||
"561a9cbc-587a-4582-8eff-f005f5b1e847",
|
||||
"561a9cbc-587a-4582-8eff-f005f5b1e847",
|
||||
]
|
||||
|
||||
manager_token = "g0Z1YYjh2WqFfoI3MdJ9wrfXAHeL6f7UatEkySzOK0dFX6CH1sXgjQ"
|
||||
people_uu_id = "2c8781f6-c1bc-432d-bb0c-9f5247ecc750"
|
||||
list_of_attendees = [
|
||||
"_Ky6UyaoatH5CZEQHZ1gdoj_7HDxSJ2DgBwq6hSXbCKR-WG8E9DPuQ",
|
||||
"KhdJF7XP6ni_qdIRXSByGHKez8oTSbmzOAZxdi2A_iy-oOW6-VbfPA",
|
||||
"vn01wNh5moTiNzw2qOvT4h5eqgCQ10jmN3OK659NN-ekriFSmVju_Q",
|
||||
"EMsteygK4Myingptlpi_sr7Xu0Wsrl7xpQD-ukVY4GBjv6NJakpQ4Q",
|
||||
"26p4QD1CofK6-Pk_VyDOB2Xstdv_sx88kh4kResWg4TuCuAy7tAT-A",
|
||||
"2FgntLgLfFM20d32-gOwaHu44Vk_fDlpOh8IvS8gahiW-V0Dv0qLWg",
|
||||
"TwC_dNuT6Iln0NFinEuvxbnjmb_HwcS8qWg-097gjc8pHTQ1p0nTGA",
|
||||
"Yn35HP9TJonn9PTFpsq1lH3w-x-zHjTWymBeP6v4XPcwJP_aMj8JsQ",
|
||||
"C2DbYn1jcocKwjQ8gvJ_jCU0IGAmbJB3JgHj-N_OTu1jNtmhVrW7aQ",
|
||||
"TT5-9a_JVSf_WBAcN1sAfUyV45J2e7J1NoVGe3BcrrlAI1GNoU2_rw",
|
||||
"ED4H5zpmxpLXX5rO6eoTb7wIa2x1v0YbNwsFh-iAohWh7fDyhvq_BQ",
|
||||
"zFhY5z05ixUxvryeGYPdchUDYhIoatghz06bb74FwJuMyrH1w4JVQw",
|
||||
"wlm0VNMnUDj91B8HLWQE9vKZsOIPcYQlHZqmgV_U_ywIOXFxR7RDxw",
|
||||
"2ckn8Jp7r0xgHqdExk82SQVUhekwSMNI6Yvd1ESV6LD4769kyeso2g",
|
||||
"6iY_p1JkptCj1JeptEUokw5BzxtcgQ3tHYkF2Vud9Cl1uzO3TJZmnQ",
|
||||
"jaOQodhZaDcEJ8_1Y2hjOlKk3f5SiaYfYU-xqDlervLdeYgHumkniw",
|
||||
"2iPk5lcTYdl_-S7odsLbN8Kij20pVNHmGSDC6gIJHIIRQ74JitP_LA",
|
||||
"cl82VDi7xQNO77v3CC7X8wcQ4i_C-K9uuKZyqnvh4KHi0ciwqXyOKA",
|
||||
"UTHZNg9gx0lZ4laDUz7S5xQ5e83vxrufqp7PbPCJx29AxhzX9DL62A",
|
||||
"rwlasXNiQXXxfRBXv78DkQeSS1S3ubV0ulrXK8cZgmCDkHAIoWvU0w",
|
||||
"JgAVc5U5lsfrbSx1gx0_SYQcO0q_K2HX8Vir5SIdiM-Z-PuHAG5cRg",
|
||||
"V_rSldMaE9P_-uEfSsyh1ojEYep4Xma3NY7BIKzuicj_wEkCqFramw",
|
||||
]
|
||||
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ı."
|
||||
living_space_data = dict(
|
||||
build_parts_uu_id="68b5e3d9-c546-4ebd-98f5-df468f20cc54",
|
||||
person_uu_id="dc135536-086f-4e11-af3a-02c7cf65f265",
|
||||
occupant_type_uu_id="a47372a9-67da-4dfb-82a9-51f9ca15ef63",
|
||||
expiry_starts=arrow.now().date().__str__(),
|
||||
)
|
||||
|
||||
|
||||
assign_people_to_create_item = 4
|
||||
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
|
||||
|
|
@ -98,44 +113,15 @@ if assign_people_to_create_item == -1:
|
|||
migrate_build(requester=both_apis)
|
||||
migrate_build_living_space(requester=both_apis)
|
||||
# migrate_account_records(requester=both_apis)
|
||||
if assign_people_to_create_item == 0:
|
||||
|
||||
|
||||
if assign_people_to_create_item == 0:
|
||||
if not bool(selection_list):
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_data, is_password_valid=True
|
||||
)
|
||||
occupant_manager = get_occupants_types(
|
||||
occupant_code="BU-MNG", requester=both_apis.local_api
|
||||
)["data"]["uu_id"]
|
||||
|
||||
response = both_apis.local_api.post(
|
||||
endpoint="/building/parts/list",
|
||||
data={"query": {"part_code": "MAN-ROOM"}},
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
response_json = response.json()
|
||||
build_parts_uu_id = response_json["data"][0]["uu_id"]
|
||||
|
||||
response = both_apis.local_api.post(
|
||||
endpoint="/user/list",
|
||||
data={"query": {"email": "mehmet.karatay@hotmail.com"}},
|
||||
)
|
||||
print("text", response.text)
|
||||
print("json", response.json())
|
||||
response_json = response.json()
|
||||
person_uu_id = response_json["data"][0]["person_uu_id"]
|
||||
|
||||
response = local_api.post(
|
||||
endpoint="/building/living_space/create",
|
||||
data=dict(
|
||||
build_parts_uu_id=build_parts_uu_id,
|
||||
person_uu_id=person_uu_id,
|
||||
occupant_type_uu_id=occupant_manager,
|
||||
expiry_starts=arrow.now().date().__str__(),
|
||||
),
|
||||
)
|
||||
print("response", response.text)
|
||||
response = local_api.post(endpoint="/building/living_space/create", data=living_space_data)
|
||||
print('response', response.text)
|
||||
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_creds_occupant,
|
||||
|
|
@ -173,33 +159,31 @@ elif assign_people_to_create_item == 2:
|
|||
selection_list=selection_list,
|
||||
)
|
||||
assign_people_to_pre_or_wrt(
|
||||
person_uu_id=people_uu_id,
|
||||
person_uu_id=people_uu_id_list[0],
|
||||
manager_token=manager_token,
|
||||
occupant_code="MT-VPR",
|
||||
requester=both_apis.local_api,
|
||||
)
|
||||
assign_people_to_pre_or_wrt(
|
||||
person_uu_id=people_uu_id,
|
||||
person_uu_id=people_uu_id_list[1],
|
||||
manager_token=manager_token,
|
||||
occupant_code="MT-WRT",
|
||||
requester=both_apis.local_api,
|
||||
)
|
||||
assign_people_to_pre_or_wrt(
|
||||
person_uu_id=people_uu_id,
|
||||
person_uu_id=people_uu_id_list[2],
|
||||
manager_token=manager_token,
|
||||
occupant_code="MT-PRS",
|
||||
requester=both_apis.local_api,
|
||||
)
|
||||
elif assign_people_to_create_item == 3:
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_creds_occupant,
|
||||
login_data=wrt_creds_occupant,
|
||||
is_password_valid=True,
|
||||
selection_list=selection_list,
|
||||
)
|
||||
|
||||
selected_decision_book_uu_id = list_decision_books(requester=both_apis.local_api)[
|
||||
"data"
|
||||
][0]["uu_id"]
|
||||
selected_decision_book_uu_id = list_decision_books(requester=both_apis.local_api)["data"][0]["uu_id"]
|
||||
print("select_company_uu_id", local_api.selected_object)
|
||||
is_fixed_price = False
|
||||
|
||||
|
|
@ -216,206 +200,100 @@ elif assign_people_to_create_item == 3:
|
|||
)["data"]["uu_id"]
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="En son toplantıda bahsedilen 2 nolu daireyi etkiliyen çözüm için kanalizasyon ve "
|
||||
"tamirleri için fiyat alınarak arka alan yağmur suyu direnajının yaplımasının projelendirilmesi.",
|
||||
"tamirleri için fiyat alınarak arka alan yağmur suyu direnajının yaplımasının projelendirilmesi.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
unit_price = 17.04
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_deb_uu_id,
|
||||
item_comment="Aidat gündemi için 1,2,3 nolu daireler için 1400 TL, diğer daireler için 1500 TL "
|
||||
"olmasına karar verildi.",
|
||||
"olmasına karar verildi.",
|
||||
unit_price=unit_price,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Hali hazırda yöneticilik görevini ifa eden 4 nolu daire sahibi Mehmet Karatayın bu "
|
||||
"görevinin devam etmesine ve apartmanın bank hesaplarının kullanımı ile ilgili yetkisinin devam etmesine.",
|
||||
"görevinin devam etmesine ve apartmanın bank hesaplarının kullanımı ile ilgili yetkisinin devam etmesine.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Kiriş içinden geçen borunun çıkarılmadan kesilmesine, gerekli tadilatın yapılıp problemin "
|
||||
"çözülmesine ayrıca bu aşamada yaplımasına onay verilirse her daire kendi radyatölerinin temizliği ve tadilatın yapılmasına.",
|
||||
"çözülmesine ayrıca bu aşamada yaplımasına onay verilirse her daire kendi radyatölerinin temizliği ve tadilatın yapılmasına.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Dogalgazdan tadilatında çıkan eski boruların satışının yapılmasına.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Apartman içinin tadilat yapılması, ışık ve elektrik sisteminin elden geçirilmesine ve elektrik "
|
||||
"sayaç il panoların kutuya konulmasına, doğalgaz borularının astar boya ile "
|
||||
"boyanmasına teklif alınarak projec açılması.",
|
||||
"sayaç il panoların kutuya konulmasına, doğalgaz borularının astar boya ile "
|
||||
"boyanmasına teklif alınarak projec açılması.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="İç kapı teklif alınarak gerektiğinde tadilatın geliştirilmesi, tek kapı yapılması "
|
||||
"yada iki kapının alternatifi ile değerlendirilerek fiyat alınması.",
|
||||
"yada iki kapının alternatifi ile değerlendirilerek fiyat alınması.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Bina su deposunun temizletilmesi.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_reno_uu_id,
|
||||
item_comment="Çatının havalandırma camlarının değiştirilmesi ve onarılması.",
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
requester=both_apis.local_api,
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
run_decision_book_items(
|
||||
writers_token=manager_token,
|
||||
writers_token=writers_token,
|
||||
info_type_uu_id=info_type_inf_uu_id,
|
||||
item_comment="Arka zemin daire sahibinin yoğun yağmurlarda evin su basmaması için "
|
||||
"arka bölüme saçak yapabilmesine onay verildi.",
|
||||
requester=both_apis.local_api,
|
||||
"arka bölüme saçak yapabilmesine onay verildi.",
|
||||
requester=both_apis.local_api
|
||||
)
|
||||
|
||||
elif assign_people_to_create_item == 4:
|
||||
|
||||
local_api.selected_object = local_api.login_via_email_and_password(
|
||||
login_data=login_creds_occupant,
|
||||
is_password_valid=True,
|
||||
selection_list=selection_list,
|
||||
)
|
||||
# for i in range(8):
|
||||
# index = i + 1
|
||||
# print("index", index)
|
||||
# if index in [1, 7, 8]:
|
||||
# continue
|
||||
# project_no = f"BDT-R_2024_{index}"
|
||||
# project = list_decision_book_project(
|
||||
# requester=both_apis.local_api, project_no=project_no
|
||||
# )
|
||||
# print("project", decode_as_json_indent(project))
|
||||
# project_uu_id = project["uu_id"]
|
||||
#
|
||||
# insert_project_item = generate_insert_project_item(
|
||||
# **{
|
||||
# "build_decision_book_project_uu_id": project_uu_id,
|
||||
# "item_header": "Toplantı sonrası alınan kararlar",
|
||||
# "item_comment": constant,
|
||||
# }
|
||||
# )
|
||||
# create_decision_book_project_items(
|
||||
# insert_project_item=insert_project_item, requester=both_apis.local_api
|
||||
# )
|
||||
# approve_project_item = {
|
||||
# "build_decision_book_project_uu_id": project_uu_id,
|
||||
# "project_stop_date": "2024-12-01",
|
||||
# "status_code": 9
|
||||
# }
|
||||
# approve_build_decision_book_project_approval(
|
||||
# approval_project_item=generate_approval_project_item(**approve_project_item),
|
||||
# requester=both_apis.local_api,
|
||||
# )
|
||||
#
|
||||
# project = list_decision_book_project(
|
||||
# requester=both_apis.local_api, project_no=project_no
|
||||
# )
|
||||
# print("project", decode_as_json_indent(project))
|
||||
|
||||
project_no = f"BDT-R_2024_7"
|
||||
project = list_decision_book_project(
|
||||
requester=both_apis.local_api, project_no=project_no
|
||||
)
|
||||
print("project", decode_as_json_indent(project))
|
||||
project_uu_id = project["uu_id"]
|
||||
|
||||
approve_project_item = lambda final_price_list : {
|
||||
"build_decision_book_project_uu_id": project_uu_id,
|
||||
"project_stop_date": "2024-12-01",
|
||||
"final_price_list": final_price_list,
|
||||
"status_code": 9
|
||||
}
|
||||
approve_project_dict = approve_project_item(
|
||||
[{"date": "2024-11-03", "price": 585.00}]
|
||||
)
|
||||
insert_project_item = generate_insert_project_item(
|
||||
**{
|
||||
"build_decision_book_project_uu_id": project_uu_id,
|
||||
"item_header": "Toplantı sonrası alınan kararlar",
|
||||
"item_comment": "Bina çalışmaları sonucunda 7020 ₺ lik maliyet çıkmıştır.",
|
||||
}
|
||||
)
|
||||
create_decision_book_project_items(
|
||||
insert_project_item=insert_project_item, requester=both_apis.local_api
|
||||
)
|
||||
approve_build_decision_book_project_approval(
|
||||
approval_project_item=generate_approval_project_item(**approve_project_dict),
|
||||
requester=both_apis.local_api,
|
||||
)
|
||||
|
||||
project = list_decision_book_project(
|
||||
requester=both_apis.local_api, project_no=project_no
|
||||
)
|
||||
print("project", decode_as_json_indent(project))
|
||||
|
||||
project_no = f"BDT-R_2024_8"
|
||||
project = list_decision_book_project(
|
||||
requester=both_apis.local_api, project_no=project_no
|
||||
)
|
||||
print("project", decode_as_json_indent(project))
|
||||
project_uu_id = project["uu_id"]
|
||||
|
||||
approve_project_dict = approve_project_item(
|
||||
[{"date": "2024-12-01", "price": 600.25}, {"date": "2025-01-01", "price": 600.50}]
|
||||
)
|
||||
insert_project_item = generate_insert_project_item(
|
||||
**{
|
||||
"build_decision_book_project_uu_id": project_uu_id,
|
||||
"item_header": "Toplantı sonrası alınan kararlar",
|
||||
"item_comment": "Bina çalışmaları sonucunda 12500 ₺ lik maliyet çıkmıştır.",
|
||||
}
|
||||
)
|
||||
create_decision_book_project_items(
|
||||
insert_project_item=insert_project_item, requester=both_apis.local_api
|
||||
)
|
||||
approve_build_decision_book_project_approval(
|
||||
approval_project_item=generate_approval_project_item(**approve_project_dict),
|
||||
requester=both_apis.local_api,
|
||||
)
|
||||
|
||||
project = list_decision_book_project(
|
||||
requester=both_apis.local_api, project_no=project_no
|
||||
)
|
||||
print("project", decode_as_json_indent(project))
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue