Skip to content

Commit fdbc003

Browse files
committed
refactor: apply aggregate pattern in app/location
1 parent 76dbfb6 commit fdbc003

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

app/location/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
from ..utils import countries
44
from ..utils.populations import country_population
55

6+
class Locations:
7+
def __init__(self,locations: list[Location]):
8+
self.locations = locations
9+
10+
def add_service(self,location):
11+
self.locations.append(location)
12+
13+
def get_location(self):
14+
return locations
615

716
# pylint: disable=redefined-builtin,invalid-name
817
class Location: # pylint: disable=too-many-instance-attributes

app/services/location/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ def __init__(self,location_services: list[LocationService]):
99
def add_service(self,location_service):
1010
self.location_services.append(location_service)
1111

12+
def get_service(self):
13+
return location_services
14+
1215
class LocationService(ABC):
1316
"""
1417
Service for retrieving locations.

0 commit comments

Comments
 (0)