Skip to content

Commit f381284

Browse files
fest(sql): Refactor read handler (#2831)
### Changed - Refactor read handler to CRUD
1 parent d49cde0 commit f381284

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

cg/cli/workflow/mutant/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@click.group(invoke_without_command=True)
2424
@click.pass_context
2525
def mutant(context: click.Context) -> None:
26-
"""Covid analysis workflow"""
26+
"""Mutant analysis workflow"""
2727
AnalysisAPI.get_help(context)
2828
context.obj.meta_apis["analysis_api"] = MutantAnalysisAPI(
2929
config=context.obj,

cg/store/api/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
22

33
from cg.store.api.find_basic_data import FindBasicDataHandler
4-
from cg.store.api.find_business_data import FindBusinessDataHandler
54
from cg.store.api.status import StatusHandler
65
from cg.store.crud.create import CreateHandler
76
from cg.store.crud.delete import DeleteDataHandler
7+
from cg.store.crud.read import ReadHandler
88
from cg.store.crud.update import UpdateHandler
99
from cg.store.database import get_session
1010

@@ -15,7 +15,7 @@ class CoreHandler(
1515
CreateHandler,
1616
DeleteDataHandler,
1717
FindBasicDataHandler,
18-
FindBusinessDataHandler,
18+
ReadHandler,
1919
StatusHandler,
2020
UpdateHandler,
2121
):
@@ -24,7 +24,7 @@ class CoreHandler(
2424
def __init__(self, session):
2525
DeleteDataHandler(session)
2626
FindBasicDataHandler(session)
27-
FindBusinessDataHandler(session)
27+
ReadHandler(session)
2828
StatusHandler(session)
2929
UpdateHandler(session)
3030

cg/store/api/find_business_data.py renamed to cg/store/crud/read.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Handler to find business data objects."""
1+
"""Handler to read data objects."""
22
import datetime as dt
33
import logging
44
from typing import Callable, Iterator
@@ -54,8 +54,8 @@
5454
LOG = logging.getLogger(__name__)
5555

5656

57-
class FindBusinessDataHandler(BaseHandler):
58-
"""Contains methods to find business data model instances."""
57+
class ReadHandler(BaseHandler):
58+
"""Class for reading items in the database."""
5959

6060
def __init__(self, session: Session):
6161
super().__init__(session=session)

tests/cli/workflow/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from cg.constants import DataDelivery, FlowCellStatus, Pipeline
99
from cg.models.cg_config import CGConfig
1010
from cg.store import Store
11-
from cg.store.api.find_business_data import FindBusinessDataHandler
11+
from cg.store.crud.read import ReadHandler
1212
from cg.store.models import Case
1313
from tests.store_helpers import StoreHelpers
1414

@@ -239,5 +239,5 @@ def mock_analysis_flow_cell(mocker) -> None:
239239
on disk."""
240240
flow_cell = Mock()
241241
flow_cell.status = FlowCellStatus.ON_DISK
242-
mocker.patch.object(FindBusinessDataHandler, "get_flow_cells_by_case")
243-
FindBusinessDataHandler.get_flow_cells_by_case.return_value = [flow_cell]
242+
mocker.patch.object(ReadHandler, "get_flow_cells_by_case")
243+
ReadHandler.get_flow_cells_by_case.return_value = [flow_cell]

tests/cli/workflow/mip/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from cg.meta.workflow.mip_rna import MipRNAAnalysisAPI
1414
from cg.meta.workflow.prepare_fastq import PrepareFastqAPI
1515
from cg.models.cg_config import CGConfig
16-
from cg.store.api.find_business_data import FindBusinessDataHandler
1716
from cg.store.api.status import StatusHandler
17+
from cg.store.crud.read import ReadHandler
1818
from cg.store.models import Case
1919
from tests.store_helpers import StoreHelpers
2020

@@ -197,5 +197,5 @@ def setup_mocks(
197197
return_value=["a str"],
198198
)
199199

200-
mocker.patch.object(FindBusinessDataHandler, "are_all_flow_cells_on_disk")
201-
FindBusinessDataHandler.are_all_flow_cells_on_disk.return_value = True
200+
mocker.patch.object(ReadHandler, "are_all_flow_cells_on_disk")
201+
ReadHandler.are_all_flow_cells_on_disk.return_value = True

0 commit comments

Comments
 (0)