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

Creational pattern (Factory Design) #472

Closed Billa32 closed 3 years ago

Billa32 commented 3 years ago

Why I did it? In order to implement Creational pattern I used the sub design of Factory Method in which i had to provide an interface for creating objects in a superclass, but allowing subclasses to alter the type of objects that will be created.

How I did it? I created a new interface class for location to implement Creational Pattern, where the interface for location class is missing so we just added and interface class in "File Path: app location init.py" to serialize the location into a dict.