services are checked
This commit is contained in:
@@ -1,49 +1,14 @@
|
||||
import typing
|
||||
|
||||
from database_sql_models import (
|
||||
from databases import (
|
||||
Modules,
|
||||
Duty,
|
||||
Services,
|
||||
Service2Events,
|
||||
OccupantTypes,
|
||||
EndpointRestriction,
|
||||
)
|
||||
|
||||
|
||||
def create_endpoints_from_api_functions():
|
||||
from app import app as api_app
|
||||
|
||||
for route in api_app.routes:
|
||||
route_path, route_summary = (
|
||||
str(getattr(route, "path")),
|
||||
str(getattr(route, "name")) or "",
|
||||
)
|
||||
# if route_path in Config.INSECURE_PATHS:
|
||||
# continue
|
||||
# print('route_path ', route_path, 'route_summary', route_summary)
|
||||
create_dict = dict(
|
||||
is_confirmed=True,
|
||||
active=True,
|
||||
deleted=False,
|
||||
is_notification_send=True,
|
||||
)
|
||||
methods = [method.lower() for method in getattr(route, "methods")]
|
||||
for route_method in methods:
|
||||
restriction = EndpointRestriction.find_or_create(
|
||||
**dict(
|
||||
endpoint_method=route_method,
|
||||
endpoint_name=route_path,
|
||||
endpoint_desc=route_summary.replace("_", " "),
|
||||
endpoint_function=route_summary,
|
||||
**create_dict,
|
||||
)
|
||||
)
|
||||
if not restriction.is_found:
|
||||
restriction.endpoint_code = f"AR{str(restriction.id).zfill(3)}"
|
||||
restriction.save()
|
||||
return
|
||||
|
||||
|
||||
def create_services_building(module_dict: dict):
|
||||
"""
|
||||
4. Service [Bina] Yönetim - OPTIONAL
|
||||
|
||||
Reference in New Issue
Block a user