ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 323 forks source link

Structural pattern #480

Closed Vimarsh-98 closed 3 years ago

Vimarsh-98 commented 3 years ago

For my structural pattern I decided to use a composite pattern.

How I did it: I applied a composite pattern to location/csbs.py and location/nyt.py. I created a new file named serialize which has the class serialize, this serializes the location into a dict. Both csbs.py and nyt.py were using the same method, so I created a separate class and imported it in csbs.py and nyt.pt. Composite pattern is used to group objects that are treated the same way as a single instance.