75 lines
3.3 KiB
Python
75 lines
3.3 KiB
Python
from Controllers.Postgres.database import get_db
|
|
from Schemas import Users, Employees, BuildLivingSpace, Services
|
|
from init_service_to_events import init_service_to_event_matches_for_super_user
|
|
from init_applications import (
|
|
init_applications_for_super_user,
|
|
# init_applications_for_general_manager,
|
|
# init_applications_for_build_manager,
|
|
# init_applications_for_owner,
|
|
# init_applications_for_tenant,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
"""
|
|
Create Applications to serve on Next.js | Create Events to add to Service
|
|
Set Events to service | Set Service to employee
|
|
"""
|
|
with get_db() as db_session:
|
|
service_super_user = Services.filter_one(Services.service_code == "SRE-SUE", db=db_session).data
|
|
user_super_user = Users.filter_one(Users.email == "karatay.berkay.sup@evyos.com.tr", db=db_session).data
|
|
employee_super_user = Employees.filter_one(Employees.people_id == user_super_user.person_id, db=db_session).data
|
|
if service_super_user and user_super_user and employee_super_user:
|
|
init_service_to_event_matches_for_super_user(
|
|
service_match=service_super_user, employee_match=employee_super_user, db_session=db_session
|
|
)
|
|
init_applications_for_super_user(
|
|
service_match=service_super_user, employee_match=employee_super_user, db_session=db_session
|
|
)
|
|
|
|
# with get_db() as db_session:
|
|
# print("Createing GM")
|
|
# if gen_man := Users.filter_one(
|
|
# Users.email == "example.general@evyos.com.tr", db=db_session
|
|
# ).data:
|
|
# gen_man_employee = Employees.filter_one(
|
|
# Employees.people_id == gen_man.person_id, db=db_session
|
|
# ).data
|
|
# print("General Manager : ", gen_man_employee)
|
|
# init_applications_for_general_manager(
|
|
# super_user=gen_man_employee, db_session=db_session
|
|
# )
|
|
|
|
# with get_db() as db_session:
|
|
# if build_man := Users.filter_one(
|
|
# Users.email == "example.build.manager@gmail.com", db=db_session
|
|
# ).data:
|
|
# build_man_employee = BuildLivingSpace.filter_one(
|
|
# BuildLivingSpace.person_id == build_man.person_id, db=db_session
|
|
# ).data
|
|
# init_applications_for_build_manager(
|
|
# super_user=build_man_employee, db_session=db_session
|
|
# )
|
|
|
|
# with get_db() as db_session:
|
|
# if own_flt := Users.filter_one(
|
|
# Users.email == "example.owner@gmail.com", db=db_session
|
|
# ).data:
|
|
# own_flt_employee = BuildLivingSpace.filter_one(
|
|
# BuildLivingSpace.person_id == own_flt.person_id, db=db_session
|
|
# ).data
|
|
# init_applications_for_owner(
|
|
# super_user=own_flt_employee, db_session=db_session
|
|
# )
|
|
|
|
# with get_db() as db_session:
|
|
# if ten_flt := Users.filter_one(
|
|
# Users.email == "example.tenant@gmail.com", db=db_session
|
|
# ).data:
|
|
# ten_flt_employee = BuildLivingSpace.filter_one(
|
|
# BuildLivingSpace.person_id == ten_flt.person_id, db=db_session
|
|
# ).data
|
|
# init_applications_for_tenant(
|
|
# super_user=ten_flt_employee, db_session=db_session
|
|
# )
|