init defaults completed

This commit is contained in:
2024-11-10 20:14:13 +03:00
parent aeda315119
commit c42a19c262
37 changed files with 582 additions and 308 deletions

View File

@@ -1,7 +1,6 @@
from api_events.events.identity.people import (
PeopleListEventMethod,
PeopleCreateEventMethod,
PeopleDeleteEventMethod,
PeopleUpdateEventMethod,
PeoplePatchEventMethod,
)
@@ -136,7 +135,6 @@ __all__ = [
"AddressPostCodeUpdateEventMethod",
"AddressPostCodeListEventMethod",
"PeopleListEventMethod",
"PeopleDeleteEventMethod",
"PeopleUpdateEventMethod",
"PeoplePatchEventMethod",
"PeopleCreateEventMethod",

View File

@@ -14,8 +14,9 @@ class ActionsSchema(ABC):
from databases import EndpointRestriction
endpoint_restriction = EndpointRestriction.filter_one(
EndpointRestriction.endpoint_name.ilike(f"%{self.endpoint}%")
).get(1)
EndpointRestriction.endpoint_name.ilike(f"%{self.endpoint}%"),
system=True
).data
if not endpoint_restriction:
raise HTTPException(
status_code=404,
@@ -32,7 +33,7 @@ class ActionsSchemaFactory:
self.action_match = self.action.retrieve_action_from_endpoint()
except Exception as e:
err = e
self.action_match = None
print(f"ActionsSchemaFactory Error: {e}")
class MethodToEvent(ABC, ActionsSchemaFactory):

View File

@@ -154,7 +154,7 @@ class AddressSearchEventMethods(MethodToEvent):
data: SearchAddress,
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
):
import databases as database_sql_models
import databases.sql_models
from time import perf_counter
st = perf_counter()
@@ -171,7 +171,7 @@ class AddressSearchEventMethods(MethodToEvent):
filter_list["order_field"] = "uu_id"
else:
filter_table = getattr(
database_sql_models, str(filter_list.get("order_field")).split(".")[0]
databases.sql_models, str(filter_list.get("order_field")).split(".")[0]
)
filter_list["order_field"] = str(filter_list.get("order_field")).split(".")[
1

View File

@@ -558,7 +558,7 @@ class AuthenticationRefreshTokenEventMethods(MethodToEvent):
cls, request: Request, data: Remember, token_dict: dict = None
):
token_refresher = UsersTokens.filter_by_one(
token=data.refresh_token, domain=data.domain, *UsersTokens.valid_record_dict
token=data.refresh_token, domain=data.domain, **UsersTokens.valid_record_dict
).data
if not token_refresher:
return JSONResponse(

View File

@@ -155,7 +155,7 @@ class AuthenticationSelectEventMethods(MethodToEvent):
Departments.id == duties.department_id,
).data
bulk_id = Duty.filter_by_one(
duty_code="BULK", *Duty.valid_record_args(Duty)
duty_code="BULK", **Duty.valid_record_args(Duty)
).data
bulk_duty_id = Duties.filter_by_one(
company_id=selected_company.id,

View File

@@ -84,7 +84,7 @@ class BuildCreateEventMethods(MethodToEvent):
created_build = Build.create_action(data=data, token=token_dict)
build_type = BuildTypes.filter_by_one(
type_code="APT_YNT", *BuildTypes.valid_record_dict
**BuildTypes.valid_record_dict, type_code="APT_YNT"
).data
if not build_type:
raise HTTPException(

View File

@@ -188,8 +188,8 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
def bind_services_employee(cls, service_id: int, employee_id: int):
from sqlalchemy.dialects.postgresql import insert
employee = Employees.filter_by_one(id=employee_id, *Employees.valid_record_dict).data
service = Services.filter_by_one(id=service_id, *Services.valid_record_dict).data
employee = Employees.filter_by_one(id=employee_id, **Employees.valid_record_dict).data
service = Services.filter_by_one(id=service_id, **Services.valid_record_dict).data
service_events = Service2Events.filter_all(
Service2Events.service_id == service.id,
*Service2Events.valid_record_args(Service2Events),
@@ -236,7 +236,7 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
)
employee = Employees.filter_by_one(
uu_id=data.employee_uu_id, *Employees.valid_record_dict
uu_id=data.employee_uu_id, **Employees.valid_record_dict
).data
if not employee:
return JSONResponse(
@@ -249,7 +249,7 @@ class ServiceBindEmployeeEventMethods(MethodToEvent):
)
service = Services.filter_by_one(
uu_id=data.service_uu_id, *Services.valid_record_dict
uu_id=data.service_uu_id, **Services.valid_record_dict
).data
if not service:
return JSONResponse(

View File

@@ -83,7 +83,7 @@ class EventsUpdateEventMethods(MethodToEvent):
@classmethod
def events_update(cls, data: CreateEvents, token_dict):
event = Events.filter_by_one(uu_id=data.uu_id, *Events.valid_record_dict).data
event = Events.filter_by_one(uu_id=data.uu_id, **Events.valid_record_dict).data
if not event:
raise HTTPException(
status_code=404,
@@ -113,7 +113,7 @@ class EventsPatchEventMethods(MethodToEvent):
@classmethod
def events_patch(cls, data: CreateEvents, token_dict):
event = Events.filter_by_one(uu_id=data.uu_id, *Events.valid_record_dict).data
event = Events.filter_by_one(uu_id=data.uu_id, **Events.valid_record_dict).data
if not event:
raise HTTPException(
status_code=404,

View File

@@ -166,6 +166,3 @@ PeopleUpdateEventMethod = PeopleUpdateEventMethods(
PeoplePatchEventMethod = PeoplePatchEventMethods(
action=ActionsSchema(endpoint="/people/patch")
)
PeopleDeleteEventMethod = PeopleDeleteEventMethods(
action=ActionsSchema(endpoint="/people/delete")
)