wag-managment-api-service-v.../ApiServices/EventService/routers/company/staff/router.py

51 lines
1.9 KiB
Python

from fastapi.routing import APIRouter
from fastapi.requests import Request
from api_validations.validations_request import (
InsertStaff,
SelectStaff,
PatchRecord,
ListOptions,
)
from ApiServices.api_handlers.auth_actions.token import parse_token_object_to_dict
staff_route = APIRouter(prefix="/staff", tags=["Staff"])
staff_route.include_router(staff_route, include_in_schema=True)
@staff_route.post(path="/list", summary="List Active/Delete/Confirm Staff")
def company_staff_list(request: Request, list_options: ListOptions):
token_dict = parse_token_object_to_dict(request=request)
return token_dict.available_event(list_options=list_options, token_dict=token_dict)
@staff_route.post(path="/get_by_duties_uu_id", summary="Get Staff by UUID")
def company_staff_get_by_uu_id(request: Request, data: SelectStaff):
token_dict = parse_token_object_to_dict(request=request)
return token_dict.available_event(data=data, token_dict=token_dict)
@staff_route.post(path="/create", summary="Create Staff with given auth levels")
def company_staff_create(request: Request, data: InsertStaff):
token_dict = parse_token_object_to_dict(request=request)
return token_dict.available_event(data=data, token_dict=token_dict)
@staff_route.post(
path="/update/{staff_uu_id}", summary="Update Staff with given auth levels"
)
def company_staff_update(request: Request, staff_uu_id: str, data):
token_dict = parse_token_object_to_dict(request=request)
return token_dict.available_event(
data=data, staff_uu_id=staff_uu_id, token_dict=token_dict
)
@staff_route.patch(path="/patch/{staff_uu_id}", summary="Update Active/Delete/Confirm")
def company_staff_patch(request: Request, staff_uu_id: str, data: PatchRecord):
token_dict = parse_token_object_to_dict(request=request)
return token_dict.available_event(
data=data, staff_uu_id=staff_uu_id, token_dict=token_dict
)