59 lines
2.0 KiB
Python
59 lines
2.0 KiB
Python
from fastapi.routing import APIRouter
|
|
from fastapi.requests import Request
|
|
|
|
from api_validations.validations_request import (
|
|
DepartmentsPydantic,
|
|
PatchRecord,
|
|
ListOptions,
|
|
)
|
|
|
|
from api_services.redis.auth_actions.token import parse_token_object_to_dict
|
|
|
|
|
|
model_route = APIRouter(prefix="/model/entities", tags=["Model Entities"])
|
|
model_route.include_router(model_route, include_in_schema=True)
|
|
|
|
|
|
@model_route.post(path="/list", summary="List Active/Delete/Confirm Events")
|
|
def model_list(request: Request, list_options: ListOptions):
|
|
from events.events_models import ModelEvents
|
|
|
|
token_dict = parse_token_object_to_dict(request=request)
|
|
active_function = getattr(ModelEvents, "model_list")
|
|
return active_function(data=list_options, token_dict=token_dict)
|
|
|
|
|
|
@model_route.post(path="/create", summary="Create Events with given auth levels")
|
|
def model_create(request: Request, data: DepartmentsPydantic):
|
|
from events.events_models import ModelEvents
|
|
|
|
token_dict = parse_token_object_to_dict(request=request)
|
|
active_function = getattr(ModelEvents, "model_create")
|
|
return active_function(data=data, token_dict=token_dict)
|
|
|
|
|
|
@model_route.post(
|
|
path="/update/{company_uu_id}", summary="Update Events with given auth levels"
|
|
)
|
|
def model_update(request: Request, company_uu_id: str, data: DepartmentsPydantic):
|
|
from events.events_models import ModelEvents
|
|
|
|
token_dict = parse_token_object_to_dict(request=request)
|
|
active_function = getattr(ModelEvents, "model_list")
|
|
return active_function(
|
|
data=data, company_uu_id=company_uu_id, token_dict=token_dict
|
|
)
|
|
|
|
|
|
@model_route.patch(
|
|
path="/patch/{company_uu_id}", summary="Patch Events with given auth levels"
|
|
)
|
|
def model_patch(request: Request, company_uu_id: str, data: PatchRecord):
|
|
from events.events_models import ModelEvents
|
|
|
|
token_dict = parse_token_object_to_dict(request=request)
|
|
active_function = getattr(ModelEvents, "model_list")
|
|
return active_function(
|
|
data=data, company_uu_id=company_uu_id, token_dict=token_dict
|
|
)
|