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

move managers #1328

Merged
merged 21 commits into from
Dec 9, 2024
Merged

move managers #1328

merged 21 commits into from
Dec 9, 2024

Conversation

mike0sv
Copy link
Collaborator

@mike0sv mike0sv commented Oct 1, 2024

No description provided.

project: Annotated[Project, Dependency()],
# snapshot_id: Annotated[SnapshotID, Parameter(title="id of snapshot")],
):
snapshot_id = request.path_params["snapshot_id"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have access to snapshot_id from request parameters as in route_handler.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path parameters are not passed to dependencies of route_handler, I tried to do this initially

snapshot_id: Annotated[SnapshotID, Parameter(title="id of snapshot")],
project_manager: Annotated[ProjectManager, Dependency(skip_validation=True)],
log_event: Callable,
user_id: UserID,
) -> None:
await project_manager.delete_snapshot(user_id, project_id, snapshot_id)
await project_manager.delete_snapshot(user_id, project.id, snapshot_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are retrieving whole project from dependency to only use project_id (that available from request itself).
This would create unnecessary calls (in comparison to original version).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also validates if project exists and that you have access to it. Thats why I did it like this, before we didn't have those checks

@mike0sv mike0sv merged commit 4309517 into main Dec 9, 2024
25 checks passed
@mike0sv mike0sv deleted the feature/controllers branch December 9, 2024 15:33
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.

2 participants