event and service sendpoints added
This commit is contained in:
@@ -444,7 +444,9 @@ def create_application_defaults(db_session):
|
||||
f"{str(company_management.uu_id)}*Domain",
|
||||
)
|
||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||
existing_record = mongo_engine.find_one({"user_uu_id": str(gen_manager_user.uu_id)})
|
||||
existing_record = mongo_engine.find_one(
|
||||
{"user_uu_id": str(gen_manager_user.uu_id)}
|
||||
)
|
||||
if not existing_record:
|
||||
mongo_engine.insert_one(
|
||||
document={
|
||||
@@ -457,11 +459,13 @@ def create_application_defaults(db_session):
|
||||
else:
|
||||
mongo_engine.update_one(
|
||||
{"user_uu_id": str(gen_manager_user.uu_id)},
|
||||
{"$set": {
|
||||
"other_domains_list": [main_domain],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}}
|
||||
{
|
||||
"$set": {
|
||||
"other_domains_list": [main_domain],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
app_manager_user = Users.find_or_create(
|
||||
@@ -483,7 +487,9 @@ def create_application_defaults(db_session):
|
||||
app_manager_user.password_token = PasswordModule.generate_refresher_token()
|
||||
|
||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||
existing_record = mongo_engine.find_one({"user_uu_id": str(app_manager_user.uu_id)})
|
||||
existing_record = mongo_engine.find_one(
|
||||
{"user_uu_id": str(app_manager_user.uu_id)}
|
||||
)
|
||||
if not existing_record:
|
||||
mongo_engine.insert_one(
|
||||
document={
|
||||
@@ -496,11 +502,13 @@ def create_application_defaults(db_session):
|
||||
else:
|
||||
mongo_engine.update_one(
|
||||
{"user_uu_id": str(app_manager_user.uu_id)},
|
||||
{"$set": {
|
||||
"other_domains_list": [main_domain],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}}
|
||||
{
|
||||
"$set": {
|
||||
"other_domains_list": [main_domain],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
sup_manager_employee = Users.find_or_create(
|
||||
@@ -524,9 +532,11 @@ def create_application_defaults(db_session):
|
||||
sup_manager_employee.password_expiry_begins = str(arrow.now())
|
||||
sup_manager_employee.password_token = PasswordModule.generate_refresher_token()
|
||||
with mongo_handler.collection(collection_name) as mongo_engine:
|
||||
existing_record = mongo_engine.find_one({"user_uu_id": str(sup_manager_employee.uu_id)})
|
||||
existing_record = mongo_engine.find_one(
|
||||
{"user_uu_id": str(sup_manager_employee.uu_id)}
|
||||
)
|
||||
if not existing_record:
|
||||
print('insert sup existing record',existing_record)
|
||||
print("insert sup existing record", existing_record)
|
||||
mongo_engine.insert_one(
|
||||
document={
|
||||
"user_uu_id": str(sup_manager_employee.uu_id),
|
||||
@@ -536,15 +546,17 @@ def create_application_defaults(db_session):
|
||||
}
|
||||
)
|
||||
else:
|
||||
print('update sup existing record',existing_record)
|
||||
print("update sup existing record", existing_record)
|
||||
# Optionally update the existing record if needed
|
||||
mongo_engine.update_one(
|
||||
{"user_uu_id": str(sup_manager_employee.uu_id)},
|
||||
{"$set": {
|
||||
"other_domains_list": [main_domain, "management.com.tr"],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}}
|
||||
{
|
||||
"$set": {
|
||||
"other_domains_list": [main_domain, "management.com.tr"],
|
||||
"main_domain": main_domain,
|
||||
"modified_at": arrow.now().timestamp(),
|
||||
}
|
||||
},
|
||||
)
|
||||
db_session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user