mongo updated
This commit is contained in:
@@ -12,15 +12,17 @@ RUN uv pip install -r requirements.txt
|
||||
|
||||
COPY ../service_app_init ./service_app_init
|
||||
|
||||
COPY ../databases ./service_app_init/databases
|
||||
COPY ../api_configs ./service_app_init/api_configs
|
||||
COPY ../api_events ./service_app_init/api_events
|
||||
COPY ../api_library ./service_app_init/api_library
|
||||
COPY ../api_validations ./service_app_init/api_validations
|
||||
COPY ../api_objects ./service_app_init/api_objects
|
||||
COPY ../api_services ./service_app_init/api_services
|
||||
COPY databases ./service_app_init/databases
|
||||
COPY api_configs ./service_app_init/api_configs
|
||||
COPY api_events ./service_app_init/api_events
|
||||
COPY api_library ./service_app_init/api_library
|
||||
COPY api_validations ./service_app_init/api_validations
|
||||
COPY api_objects ./service_app_init/api_objects
|
||||
COPY api_services ./service_app_init/api_services
|
||||
|
||||
COPY ApiServices ./service_app_init/ApiServices
|
||||
COPY ApiServices/EventService/routers ./service_app_init/routers
|
||||
#COPY ../service_app/application ./service_app_init/application
|
||||
#COPY ../service_app/routers ./service_app_init/routers
|
||||
|
||||
WORKDIR /service_app_init
|
||||
|
||||
|
||||
@@ -17,147 +17,146 @@ def do_alembic():
|
||||
generate_alembic_with_session(text=text)
|
||||
|
||||
|
||||
#
|
||||
# def create_one_address():
|
||||
# from databases import (
|
||||
# AddressCity,
|
||||
# AddressStreet,
|
||||
# AddressLocality,
|
||||
# AddressDistrict,
|
||||
# AddressNeighborhood,
|
||||
# AddressState,
|
||||
# AddressCountry,
|
||||
# )
|
||||
#
|
||||
# address_list = []
|
||||
# country = AddressCountry.find_or_create(country_name="TÜRKİYE", country_code="TR")
|
||||
# address_list.append(country)
|
||||
# state = AddressState.find_or_create(
|
||||
# state_name="TÜRKİYE",
|
||||
# state_code="TR",
|
||||
# phone_code="90",
|
||||
# country_id=country.id,
|
||||
# country_uu_id=str(country.uu_id),
|
||||
# )
|
||||
# address_list.append(state)
|
||||
# city = AddressCity.find_or_create(
|
||||
# city_name="ANKARA",
|
||||
# city_code="6",
|
||||
# licence_plate="06",
|
||||
# state_id=state.id,
|
||||
# state_uu_id=str(state.uu_id),
|
||||
# )
|
||||
# address_list.append(city)
|
||||
# district = AddressDistrict.find_or_create(
|
||||
# district_name="ÇANKAYA",
|
||||
# district_code="1231",
|
||||
# city_id=city.id,
|
||||
# city_uu_id=str(city.uu_id),
|
||||
# )
|
||||
# address_list.append(district)
|
||||
# locality = AddressLocality.find_or_create(
|
||||
# locality_name="MERKEZ",
|
||||
# locality_code="2431",
|
||||
# type_code="3",
|
||||
# type_description=None,
|
||||
# district_id=district.id,
|
||||
# district_uu_id=str(district.uu_id),
|
||||
# )
|
||||
# address_list.append(locality)
|
||||
# neighborhood = AddressNeighborhood.find_or_create(
|
||||
# neighborhood_name="AYRANCI MAHALLESİ",
|
||||
# neighborhood_code="1522",
|
||||
# type_code="1",
|
||||
# type_description="MAHALLESİ",
|
||||
# locality_id=locality.id,
|
||||
# locality_uu_id=str(locality.uu_id),
|
||||
# )
|
||||
# address_list.append(neighborhood)
|
||||
# street = AddressStreet.find_or_create(
|
||||
# street_name="REŞAT NURİ CADDESİ",
|
||||
# type_description="CADDESİ",
|
||||
# type_code="3",
|
||||
# street_code="52270",
|
||||
# neighborhood_id=neighborhood.id,
|
||||
# neighborhood_uu_id=str(neighborhood.uu_id),
|
||||
# )
|
||||
# address_list.append(street)
|
||||
# for address_single in address_list:
|
||||
# address_single.save_and_confirm()
|
||||
# return
|
||||
#
|
||||
#
|
||||
# def create_application_defaults_func(create_address=False):
|
||||
# from initialize_app import (
|
||||
# create_modules_and_services_and_actions,
|
||||
# create_endpoints_from_api_functions,
|
||||
# create_all_events_from_actions,
|
||||
# create_application_defaults,
|
||||
# init_api_enums_build_types,
|
||||
# add_events_all_services_and_occupant_types,
|
||||
# add_events_to_system_super_user,
|
||||
# create_occupant_types_defaults,
|
||||
# )
|
||||
# import routers
|
||||
#
|
||||
# try:
|
||||
# create_endpoints_from_api_functions(routers=routers)
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} create_endpoints_from_api_functions Defaults Error",
|
||||
# e,
|
||||
# )
|
||||
# try:
|
||||
# create_application_defaults()
|
||||
# except Exception as e:
|
||||
# print(f"{TerminalColors.WARNING} create_application_defaults Defaults Error", e)
|
||||
# try:
|
||||
# create_occupant_types_defaults()
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} create_occupant_types_defaults Defaults Error", e
|
||||
# )
|
||||
# try:
|
||||
# create_modules_and_services_and_actions()
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} create_modules_and_services_and_actions Defaults Error",
|
||||
# e,
|
||||
# )
|
||||
# try:
|
||||
# init_api_enums_build_types()
|
||||
# except Exception as e:
|
||||
# print(f"{TerminalColors.WARNING} init_api_enums_build_types Defaults Error", e)
|
||||
# try:
|
||||
# create_all_events_from_actions()
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} create_all_events_from_actions Defaults Error", e
|
||||
# )
|
||||
# try:
|
||||
# add_events_all_services_and_occupant_types()
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} add_events_all_services_and_occupant_types Defaults Error",
|
||||
# e,
|
||||
# )
|
||||
# try:
|
||||
# add_events_to_system_super_user()
|
||||
# except Exception as e:
|
||||
# print(
|
||||
# f"{TerminalColors.WARNING} add_events_to_system_super_user Defaults Error",
|
||||
# e,
|
||||
# )
|
||||
# try:
|
||||
# if not create_address:
|
||||
# return
|
||||
# create_one_address()
|
||||
# except Exception as e:
|
||||
# print(f"{TerminalColors.WARNING} create_one_address Defaults Error", e)
|
||||
#
|
||||
def create_one_address():
|
||||
from databases import (
|
||||
AddressCity,
|
||||
AddressStreet,
|
||||
AddressLocality,
|
||||
AddressDistrict,
|
||||
AddressNeighborhood,
|
||||
AddressState,
|
||||
AddressCountry,
|
||||
)
|
||||
|
||||
address_list = []
|
||||
country = AddressCountry.find_or_create(country_name="TÜRKİYE", country_code="TR")
|
||||
address_list.append(country)
|
||||
state = AddressState.find_or_create(
|
||||
state_name="TÜRKİYE",
|
||||
state_code="TR",
|
||||
phone_code="90",
|
||||
country_id=country.id,
|
||||
country_uu_id=str(country.uu_id),
|
||||
)
|
||||
address_list.append(state)
|
||||
city = AddressCity.find_or_create(
|
||||
city_name="ANKARA",
|
||||
city_code="6",
|
||||
licence_plate="06",
|
||||
state_id=state.id,
|
||||
state_uu_id=str(state.uu_id),
|
||||
)
|
||||
address_list.append(city)
|
||||
district = AddressDistrict.find_or_create(
|
||||
district_name="ÇANKAYA",
|
||||
district_code="1231",
|
||||
city_id=city.id,
|
||||
city_uu_id=str(city.uu_id),
|
||||
)
|
||||
address_list.append(district)
|
||||
locality = AddressLocality.find_or_create(
|
||||
locality_name="MERKEZ",
|
||||
locality_code="2431",
|
||||
type_code="3",
|
||||
type_description=None,
|
||||
district_id=district.id,
|
||||
district_uu_id=str(district.uu_id),
|
||||
)
|
||||
address_list.append(locality)
|
||||
neighborhood = AddressNeighborhood.find_or_create(
|
||||
neighborhood_name="AYRANCI MAHALLESİ",
|
||||
neighborhood_code="1522",
|
||||
type_code="1",
|
||||
type_description="MAHALLESİ",
|
||||
locality_id=locality.id,
|
||||
locality_uu_id=str(locality.uu_id),
|
||||
)
|
||||
address_list.append(neighborhood)
|
||||
street = AddressStreet.find_or_create(
|
||||
street_name="REŞAT NURİ CADDESİ",
|
||||
type_description="CADDESİ",
|
||||
type_code="3",
|
||||
street_code="52270",
|
||||
neighborhood_id=neighborhood.id,
|
||||
neighborhood_uu_id=str(neighborhood.uu_id),
|
||||
)
|
||||
address_list.append(street)
|
||||
for address_single in address_list:
|
||||
address_single.save_and_confirm()
|
||||
return
|
||||
|
||||
|
||||
def create_application_defaults_func(create_address=False):
|
||||
from initialize_app import (
|
||||
create_modules_and_services_and_actions,
|
||||
create_endpoints_from_api_functions,
|
||||
create_all_events_from_actions,
|
||||
create_application_defaults,
|
||||
init_api_enums_build_types,
|
||||
add_events_all_services_and_occupant_types,
|
||||
add_events_to_system_super_user,
|
||||
create_occupant_types_defaults,
|
||||
)
|
||||
import routers
|
||||
|
||||
try:
|
||||
create_endpoints_from_api_functions(routers=routers)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} create_endpoints_from_api_functions Defaults Error",
|
||||
e,
|
||||
)
|
||||
try:
|
||||
create_application_defaults()
|
||||
except Exception as e:
|
||||
print(f"{TerminalColors.WARNING} create_application_defaults Defaults Error", e)
|
||||
try:
|
||||
create_occupant_types_defaults()
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} create_occupant_types_defaults Defaults Error", e
|
||||
)
|
||||
try:
|
||||
create_modules_and_services_and_actions()
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} create_modules_and_services_and_actions Defaults Error",
|
||||
e,
|
||||
)
|
||||
try:
|
||||
init_api_enums_build_types()
|
||||
except Exception as e:
|
||||
print(f"{TerminalColors.WARNING} init_api_enums_build_types Defaults Error", e)
|
||||
try:
|
||||
create_all_events_from_actions()
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} create_all_events_from_actions Defaults Error", e
|
||||
)
|
||||
try:
|
||||
add_events_all_services_and_occupant_types()
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} add_events_all_services_and_occupant_types Defaults Error",
|
||||
e,
|
||||
)
|
||||
try:
|
||||
add_events_to_system_super_user()
|
||||
except Exception as e:
|
||||
print(
|
||||
f"{TerminalColors.WARNING} add_events_to_system_super_user Defaults Error",
|
||||
e,
|
||||
)
|
||||
try:
|
||||
if not create_address:
|
||||
return
|
||||
create_one_address()
|
||||
except Exception as e:
|
||||
print(f"{TerminalColors.WARNING} create_one_address Defaults Error", e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Service App Initial Default Runner is running")
|
||||
do_alembic()
|
||||
# create_application_defaults_func(create_address=True)
|
||||
# do_alembic()
|
||||
create_application_defaults_func(create_address=True)
|
||||
print("Service App Initial Default Runner is completed")
|
||||
|
||||
Reference in New Issue
Block a user