298 lines
11 KiB
Python
298 lines
11 KiB
Python
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,
|
||
)
|
||
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_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,
|
||
migrate_build_living_space,
|
||
)
|
||
from service_app_test.test_application.migrate_old_data.company import migrate_company
|
||
from service_app_test.test_application.migrate_old_data.accounts import (
|
||
migrate_account_records,
|
||
)
|
||
|
||
|
||
password_token = "LmHm9SmX9GiHRkb6Z0GqI4cEzEnxmesMDSWPZEyNqF-9endOcN_qgLKa5kXP8P_oMloNy5EURn4Lq8dZljil2m0_OTAgZRjTqInYb84rsWqqRf8JMqaI7m6UKle_drToNZlnfjpOSgNbbisX3xQv7SvkWBGrWSm4QSI_poRZrgztV2wJZipge7atLopQOFW5"
|
||
login_data = {
|
||
"domain": "evyos.com.tr",
|
||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||
"password": "string",
|
||
"remember_me": False,
|
||
"password_token": password_token,
|
||
}
|
||
login_creds_employee = {
|
||
"domain": "evyos.com.tr",
|
||
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
||
"password": "string",
|
||
"remember_me": False,
|
||
"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": "wU1OkD5HEicfNEs_Azm-PjEOaQT4uO9vmnKgtMrME0rNCS4rbMwj6mTXteu5i0DS8EoQOB0XXdN-BWsU0FvRRMND5wzTHHc4k5eb62blrXnM8IHRlFpxObUflGwjOF4tNoTeU53z5zqqHgaHMFAD6GUtZSeXwoSpQcLcag-OqdVmOL82GBmEXXU8bodKL5_y"
|
||
}
|
||
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 = [
|
||
"a44fb2c0-42a4-4193-b964-73dcbf605110",
|
||
"463ae98b-07e7-4e76-8de1-d5984fed91fa",
|
||
]
|
||
# selection_list = None
|
||
manager_token = "WmtHuV0DeWlYAs68PTiM5q100UTzGweh8B2rZAuwrwFqm1r4FhQqcg"
|
||
writers_token = manager_token
|
||
people_uu_id_list = [
|
||
"2f1d6e3e-aca2-4bfa-a3e7-ce32eb7e02b2",
|
||
"2f1d6e3e-aca2-4bfa-a3e7-ce32eb7e02b2",
|
||
"2f1d6e3e-aca2-4bfa-a3e7-ce32eb7e02b2",
|
||
]
|
||
|
||
list_of_attendees = [
|
||
"mkQtBLD-zMP94KMz21VFXN2bORlWEqlqM7zQT8GGkvwS0uLGEk3y6Q",
|
||
"clp8xw-etegFaVsqVflsz6oIO-SchIvARZO2_t8qaSOOrIlA93Xmeg",
|
||
"-FsZrl9bhcKONRGFKJIX1wHPjYQU-GEwydiuXhtNLWB5WxPTusSNhQ",
|
||
"HhozHBzoilMYrNI6Li4tYz27LSz2PC2vPxrM0Y7FvbsTXMeDR9EX8Q",
|
||
"0s6lOAOQJqARSNx7uTlRjMoIqmC7pEcs6Zo-Q3XmGZPWnv_qLTVXbg",
|
||
"EulS8ex9ywa22jp55P6L-Bfnolvb8bIZTirlZn2cSk8_g3sPyYv8gg",
|
||
"v9zti5nMhronCi4e-Ud_9MKYwjwg36So6s3kM-v05WnFqeedhgpDbQ",
|
||
"uqNBMsqguoyrcEPAmYv5_FNDo_xKtprft4eBx350PKImm4Hq2UdeMw",
|
||
"WkREg0XBpW8f-XEKePoOmMiLKReyqo7_4RRUdne4O1nvqt5EtAOJXA",
|
||
"Z7zCBEdFTaX-jSo_e29KGXSGc1MKTaGL93KrqKJfV1fqhaepl6iv7g",
|
||
"okfCZ1JQuphfZ4GT47tGwmKXCidyxpf1f6wcjsLRVnS6-AU5_EbLJg",
|
||
]
|
||
living_space_data = dict(
|
||
build_parts_uu_id="a44fb2c0-42a4-4193-b964-73dcbf605110",
|
||
person_uu_id="269d1bdc-1495-4e5f-afef-20dd5c3e22be",
|
||
occupant_type_uu_id="6c98e522-6b4c-4951-8e1e-e33c14b4d779",
|
||
expiry_starts=arrow.now().date().__str__(),
|
||
)
|
||
|
||
|
||
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
|
||
)
|
||
migrate_company(requester=both_apis)
|
||
migrate_people(requester=both_apis)
|
||
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 not bool(selection_list):
|
||
local_api.selected_object = local_api.login_via_email_and_password(
|
||
login_data=login_data, is_password_valid=True
|
||
)
|
||
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,
|
||
is_password_valid=bool(selection_list),
|
||
selection_list=selection_list,
|
||
)
|
||
selected_decision_book_uu_id = run_decision_book_depends(
|
||
requester=both_apis.local_api
|
||
)
|
||
send_invitation = {
|
||
"build_decision_book_uu_id": selected_decision_book_uu_id,
|
||
"message": "Request for a Regular Building Meeting",
|
||
"planned_date": arrow.now().shift(days=2).date().__str__(),
|
||
}
|
||
send_invitation_to_building_residents(
|
||
send_invitation_dict=send_invitation, requester=both_apis.local_api
|
||
)
|
||
elif assign_people_to_create_item == 1:
|
||
local_api.selected_object = local_api.login_via_email_and_password(
|
||
login_data=login_creds_occupant,
|
||
is_password_valid=True,
|
||
selection_list=selection_list,
|
||
)
|
||
count = 7
|
||
list_of_attendees.insert(0, manager_token)
|
||
collect_invitation_to_building_residents(
|
||
attended_dict_list=list_of_attendees,
|
||
attend_count=count + 1,
|
||
requester=both_apis.local_api,
|
||
)
|
||
elif assign_people_to_create_item == 2:
|
||
local_api.selected_object = local_api.login_via_email_and_password(
|
||
login_data=login_creds_occupant,
|
||
is_password_valid=True,
|
||
selection_list=selection_list,
|
||
)
|
||
assign_people_to_pre_or_wrt(
|
||
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_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_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=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"]
|
||
print("select_company_uu_id", local_api.selected_object)
|
||
is_fixed_price = False
|
||
|
||
start_date, end_date = "2024-11-01", "2024-12-01"
|
||
|
||
info_type_reno_uu_id = get_type_codes_key_and_class(
|
||
class_name="BuildDuesTypes", key_name="BDT-R", requester=both_apis.local_api
|
||
)["data"]["uu_id"]
|
||
info_type_deb_uu_id = get_type_codes_key_and_class(
|
||
class_name="BuildDuesTypes", key_name="BDT-D", requester=both_apis.local_api
|
||
)["data"]["uu_id"]
|
||
info_type_inf_uu_id = get_type_codes_key_and_class(
|
||
class_name="BuildDuesTypes", key_name="BDT-I", requester=both_apis.local_api
|
||
)["data"]["uu_id"]
|
||
|
||
run_decision_book_items(
|
||
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.",
|
||
start_date=start_date,
|
||
end_date=end_date,
|
||
is_fixed=False,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
unit_price = 17.04
|
||
run_decision_book_items(
|
||
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.",
|
||
unit_price=unit_price,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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.",
|
||
start_date=start_date,
|
||
end_date=end_date,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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.",
|
||
start_date=start_date,
|
||
end_date=end_date,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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ı.",
|
||
start_date=start_date,
|
||
end_date=end_date,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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ı.",
|
||
start_date=start_date,
|
||
end_date=end_date,
|
||
requester=both_apis.local_api
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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
|
||
)
|
||
|
||
run_decision_book_items(
|
||
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
|
||
)
|