-
-
Notifications
You must be signed in to change notification settings - Fork 49
Feature/issue 177 #266
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
base: main
Are you sure you want to change the base?
Feature/issue 177 #266
Changes from all commits
1a5dea6
2f60ac4
3ff845f
a771b69
a5cac49
45af02a
9b0c16f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,22 @@ | |
| import database.flows | ||
| from core.conversions import _str_to_num | ||
| from routers.dependencies import expdb_connection | ||
| from schemas.flows import Flow, Parameter, Subflow | ||
| from schemas.flows import Flow, FlowExistsBody, Parameter, Subflow | ||
|
|
||
| router = APIRouter(prefix="/flows", tags=["flows"]) | ||
|
|
||
|
|
||
| @router.get("/exists/{name}/{external_version}") | ||
| @router.post("/exists") | ||
| def flow_exists( | ||
| name: str, | ||
| external_version: str, | ||
| body: FlowExistsBody, | ||
| expdb: Annotated[Connection, Depends(expdb_connection)], | ||
| ) -> dict[Literal["flow_id"], int]: | ||
| """Check if a Flow with the name and version exists, if so, return the flow id.""" | ||
| flow = database.flows.get_by_name(name=name, external_version=external_version, expdb=expdb) | ||
| flow = database.flows.get_by_name( | ||
| name=body.name, | ||
| external_version=body.external_version, | ||
| expdb=expdb, | ||
| ) | ||
| if flow is None: | ||
| raise HTTPException( | ||
| status_code=HTTPStatus.NOT_FOUND, | ||
|
|
@@ -28,6 +31,16 @@ def flow_exists( | |
| return {"flow_id": flow.id} | ||
|
|
||
|
|
||
| @router.get("/exists/{name}/{external_version}", deprecated=True) | ||
| def flow_exists_get( | ||
| name: str, | ||
| external_version: str, | ||
| expdb: Annotated[Connection, Depends(expdb_connection)], | ||
| ) -> dict[Literal["flow_id"], int]: | ||
| """Deprecated: use POST /flows/exists instead.""" | ||
| return flow_exists(FlowExistsBody(name=name, external_version=external_version), expdb) | ||
|
Comment on lines
+34
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add coverage for the deprecated shim.
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| @router.get("/{flow_id}") | ||
| def get_flow(flow_id: int, expdb: Annotated[Connection, Depends(expdb_connection)] = None) -> Flow: | ||
| flow = database.flows.get(flow_id, expdb) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.