Skip to content

Conversation

@JeevenDhanoa
Copy link

@JeevenDhanoa JeevenDhanoa commented Jul 24, 2021

What does this PR do?

This PR creates a new util file, app/utils/data_urls.py, which serves as the root for a new aggregate pattern. For this aggregate, the DataURLs class in the new util file serves as the aggregate root, through which the different URLs to access each data source (which form the boundary) can be retrieved. I made these changes by first creating the new util file, then removing the local BASE_URL variables that each location service sets and instead referring to the appropriate URL contained within DataURLs in each of the location service files (csbs.py, jhu.py, and nyt.py). It was also necessary to add an import to the new util file within each of these location service files.

Why make these changes?

Since each of the three location services "have a" BASE_URL, it seems intuitive that applying an aggregate pattern here would help simplify the domain model, specifically for each of the location services. In the new aggregate, DataURLs is the publicly visible root which each of the location services have a "has a" relationship with, instead of with the individual data source URLs. These URLs instead make up the boundary of the aggregate. Making these data source URLs accessible through enums makes sense, though an alternative would be to store them in a dictionary, as in pull request #363. I chose the name of DataURLs for the aggregate's root because it is fairly descriptive of what the purpose of this aggregate is: to contain the individual URLs to access each data source.

@ExpDev07 ExpDev07 closed this Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants