Skip to content

Commit

Permalink
Refactor WellCompletions back-end code (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenherje authored Sep 25, 2023
1 parent dc926f5 commit 4a83790
Show file tree
Hide file tree
Showing 29 changed files with 447 additions and 450 deletions.
4 changes: 2 additions & 2 deletions backend/src/backend/primary/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .routers.correlations.router import router as correlations_router
from .routers.grid.router import router as grid_router
from .routers.pvt.router import router as pvt_router
from .routers.well_completion.router import router as well_completion_router
from .routers.well_completions.router import router as well_completions_router
from .routers.well.router import router as well_router
from .routers.surface_polygons.router import router as surface_polygons_router

Expand Down Expand Up @@ -53,7 +53,7 @@ def custom_generate_unique_id(route: APIRoute) -> str:
app.include_router(correlations_router, prefix="/correlations", tags=["correlations"])
app.include_router(grid_router, prefix="/grid", tags=["grid"])
app.include_router(pvt_router, prefix="/pvt", tags=["pvt"])
app.include_router(well_completion_router, prefix="/well_completion", tags=["well_completion"])
app.include_router(well_completions_router, prefix="/well_completions", tags=["well_completions"])
app.include_router(well_router, prefix="/well", tags=["well"])
app.include_router(surface_polygons_router, prefix="/surface_polygons", tags=["surface_polygons"])

Expand Down
30 changes: 0 additions & 30 deletions backend/src/backend/primary/routers/well_completion/router.py

This file was deleted.

This file was deleted.

29 changes: 29 additions & 0 deletions backend/src/backend/primary/routers/well_completions/router.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import Optional

from fastapi import APIRouter, Depends, HTTPException, Query

from src.backend.auth.auth_helper import AuthHelper
from src.services.utils.authenticated_user import AuthenticatedUser

from src.services.sumo_access.well_completions_access import WellCompletionsAccess
from src.services.sumo_access.well_completions_types import WellCompletionsData

router = APIRouter()


@router.get("/well_completions_data/")
def get_well_completions_data(
# fmt:off
authenticated_user: AuthenticatedUser = Depends(AuthHelper.get_authenticated_user),
case_uuid: str = Query(description="Sumo case uuid"),
ensemble_name: str = Query(description="Ensemble name"),
realization: Optional[int] = Query(None, description="Optional realization to include. If not specified, all realizations will be returned."),
# fmt:on
) -> WellCompletionsData:
access = WellCompletionsAccess(authenticated_user.get_sumo_access_token(), case_uuid, ensemble_name)
well_completions_data = access.get_well_completions_data(realization=realization)

if not well_completions_data:
raise HTTPException(status_code=404, detail="Well completions data not found")

return well_completions_data
70 changes: 0 additions & 70 deletions backend/src/services/sumo_access/well_completion_access.py

This file was deleted.

Loading

0 comments on commit 4a83790

Please sign in to comment.