Closed pbrochar closed 6 months ago
https://github.com/mpruvot/python_chess_app/blob/9a22b93faca5e7b7fc8a8d75bca898c75c7f34fe/services/strapi_service.py#L23
It's current to create classes to do this kind of jobs:
like
class PlayerFactory: @staticmethod def from_strapi_response(strapi_response: dict[str, Any]) -> Player: player_attributes = strapi_response["attributes"] player_id = strapi_response["id"] player = Player(**player_attributes) player.player_id = player_id return player
If tomorrow we want to instantiate players from another data source, it'll be easier.
Fixed
https://github.com/mpruvot/python_chess_app/blob/9a22b93faca5e7b7fc8a8d75bca898c75c7f34fe/services/strapi_service.py#L23
It's current to create classes to do this kind of jobs:
like
If tomorrow we want to instantiate players from another data source, it'll be easier.