Skip to content

Commit

Permalink
fix(1139): rename forest client integration schema, refs: #1139
Browse files Browse the repository at this point in the history
  • Loading branch information
MCatherine1994 committed Feb 8, 2024
1 parent bb78831 commit 601cfd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import logging
from http import HTTPStatus
from typing import List

import requests
from api.config import config
from api.app.schemas import ForestClientIntegrationFindResponse

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -30,7 +32,7 @@ def __init__(self):
self.session = requests.Session()
self.session.headers.update(self.headers)

def find_by_client_number(self, p_client_number: str):
def find_by_client_number(self, p_client_number: str) -> List[ForestClientIntegrationFindResponse]:
"""
Find Forest Client(s) information based on p_client_number search query field.
Expand Down
4 changes: 2 additions & 2 deletions server/admin_management/api/app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ class AdminUserAccessResponse(BaseModel):
model_config = ConfigDict(from_attributes=True)


# ------------------------------------- Forest Client Validator ---------------------------------------- #
class ForestClientValidationResponse(BaseModel):
# ------------------------------------- Forest Client API Integraion ---------------------------------------- #
class ForestClientIntegrationFindResponse(BaseModel):
clientNumber: str
clientName: str
clientStatusCode: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
from typing import List, Union

from api.app.constants import FOREST_CLIENT_STATUS
from api.app.schemas import ForestClientValidationResponse
from api.app.schemas import ForestClientIntegrationFindResponse


LOGGER = logging.getLogger(__name__)


def forest_client_number_exists(
forest_client_find_result: List[ForestClientValidationResponse],
forest_client_find_result: List[ForestClientIntegrationFindResponse],
) -> bool:
# Exact client number search - should only contain 1 result.
return len(forest_client_find_result) == 1


def forest_client_active(
forest_client_find_result: List[ForestClientValidationResponse],
forest_client_find_result: List[ForestClientIntegrationFindResponse],
) -> bool:
return (
(
Expand All @@ -29,7 +29,7 @@ def forest_client_active(


def get_forest_client_status(
forest_client_find_result: List[ForestClientValidationResponse],
forest_client_find_result: List[ForestClientIntegrationFindResponse],
) -> Union[str, None]:
return (
forest_client_find_result[0][FOREST_CLIENT_STATUS["KEY"]]
Expand Down

0 comments on commit 601cfd4

Please sign in to comment.