generated from Maua-Dev/battlesnake_fastapi_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update main file to use repo methods
- Loading branch information
1 parent
be0096e
commit d6a1617
Showing
6 changed files
with
137 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
from enum import Enum | ||
|
||
from .errors.environment_errors import EnvironmentNotFound | ||
|
||
from .repo.item_repository_interface import IItemRepository | ||
|
||
|
||
class REPO(Enum): | ||
MOCK = "MOCK" | ||
|
||
class Environments: | ||
""" | ||
This is an abstraction of "Environments" to simplify the concept. The environments are hardcoded in this class. | ||
""" | ||
repo: REPO = REPO.MOCK | ||
@staticmethod | ||
def get_item_repo() -> IItemRepository: | ||
if Environments.repo == REPO.MOCK: | ||
from .repo.item_repository_mock import ItemRepositoryMock | ||
return ItemRepositoryMock | ||
else: | ||
raise EnvironmentNotFound("REPO") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .base_error import BaseError | ||
|
||
|
||
class EnvironmentNotFound(BaseError): | ||
def __init__(self, env: str, message: str): | ||
super().__init__(f'The environment {env} is wrong') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.