Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): decorator variable must match the function argument #1483

Merged

Conversation

vilsbole
Copy link
Contributor

@vilsbole vilsbole commented Dec 3, 2024

Fix #1477 /api/user_template endpoints.

The routers decorator must match the function argument, so if we use
def get_user_template(template_id: int, db: Session = Depends(get_db)):

then the decorator should also use {template_id} rather than {id}

@router.get("/user_template/{template_id}", response_model=UserTemplateResponse)
def get_user_template_endpoint(
    dbuser_template: UserTemplateResponse = Depends(get_user_template),
    admin: Admin = Depends(Admin.get_current)):
    """Get User Template information with id"""
    return dbuser_template

We could choose either one. This PR makes the arbitrary choice of using template_id.

@ImMohammad20000
Copy link
Collaborator

change target branch to dev

@vilsbole vilsbole changed the base branch from master to dev December 3, 2024 10:08
@vilsbole
Copy link
Contributor Author

vilsbole commented Dec 3, 2024

change target branch to dev

Done ✅

Any change you can do a patch release for this fix?

@ImMohammad20000 ImMohammad20000 merged commit ae47dd0 into Gozargah:dev Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET /api/user_template/{id} fails
2 participants