mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Define classes
This commit is contained in:
parent
cdf5046dce
commit
694bb0b569
6 changed files with 45 additions and 9 deletions
11
backend/condition/domain/asset_condition.py
Normal file
11
backend/condition/domain/asset_condition.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from backend.condition.domain.element import Element
|
||||
|
||||
@dataclass
|
||||
class AssetCondition:
|
||||
uprn: int
|
||||
element: Element
|
||||
condition_description: str
|
||||
renewal_year: Optional[int] = None
|
||||
4
backend/condition/domain/element.py
Normal file
4
backend/condition/domain/element.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from enum import Enum
|
||||
|
||||
class Element(Enum):
|
||||
pass
|
||||
9
backend/condition/domain/mapping/lbwf_mapper.py
Normal file
9
backend/condition/domain/mapping/lbwf_mapper.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from typing import Any, List
|
||||
from backend.condition.domain.asset_condition import AssetCondition
|
||||
from backend.condition.domain.mapping.mapper import Mapper
|
||||
|
||||
|
||||
class LbwfMapper(Mapper):
|
||||
|
||||
def map_asset_conditions(self, client_data: List[Any]) -> List[AssetCondition]:
|
||||
raise NotImplementedError
|
||||
11
backend/condition/domain/mapping/mapper.py
Normal file
11
backend/condition/domain/mapping/mapper.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Any, List
|
||||
|
||||
from backend.condition.domain.asset_condition import AssetCondition
|
||||
|
||||
class Mapper(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def map_asset_conditions(self, client_data: List[Any]) -> List[AssetCondition]:
|
||||
#TODO: client_data should be properly typed
|
||||
pass
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
from dataclasses import dataclass
|
||||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -16,11 +17,11 @@ class LbwfAssetCondition:
|
|||
element_code_description: str
|
||||
attribute_code: str
|
||||
attribute_code_description: str
|
||||
element_date_value: str | None = None
|
||||
element_numerical_value: int | None = None
|
||||
element_text_value: str | None = None
|
||||
quantity: int | None = None
|
||||
install_date: date | None = None
|
||||
remaining_life: int | None = None
|
||||
element_comments: str | None = None
|
||||
element_date_value: Optional[str] = None
|
||||
element_numerical_value: Optional[int] = None
|
||||
element_text_value: Optional[str] = None
|
||||
quantity: Optional[int] = None
|
||||
install_date: Optional[date] = None
|
||||
remaining_life: Optional[int] = None
|
||||
element_comments: Optional[str] = None
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ class LbwfHouse:
|
|||
uprn: int
|
||||
reference: int
|
||||
address: str
|
||||
epc: str # TODO: make enum
|
||||
shdf: bool
|
||||
epc: str # TODO: make enum?
|
||||
shdf: str
|
||||
house: str
|
||||
fail_decency: int
|
||||
assets: List[LbwfAssetCondition]
|
||||
Loading…
Add table
Reference in a new issue