Open
Description
Please add the feature or support of dependencies in endpoint decorator.
@View(router, path='/vehicles')
class VehicleMasterAPI:
@staticmethod
async def get(get_vehicle_crud: VehicleMasterCRUD = Depends(
get_repository(VehicleMasterCRUD)
)) -> list[dict] | list:
return await get_vehicle_crud.get_all_vehicles()
@endpoint(dependencies=[Depends(Authentication(mode="ADMIN", permission_codes=[0, 2, 5, 7]))])
async def post(self, get_data: VehicleMasterValidator, get_vehicle_crud: VehicleMasterCRUD = Depends(
get_repository(VehicleMasterCRUD)
)):
if not await get_vehicle_crud.exists(name=get_data.name):
await get_vehicle_crud.add_vehicle(**get_data.dict())
return {
'status': 'success'
}
return {
'status': 'already_exists',
}
I am added the example how I want use this decorator.
Metadata
Metadata
Assignees
Labels
No labels