Skip to content

dependencies parameter is not accepting in @endpoint decorator. #183

Open
@rsvijaytiwari

Description

@rsvijaytiwari

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions