Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Why is AuthorInterface used in PGMNodeService in the example? #35

Open
TRBF opened this issue Jul 31, 2024 · 0 comments
Open

Comments

@TRBF
Copy link

TRBF commented Jul 31, 2024

Something confuses me a little. I know the styleguide mentions that only services.py interacts with the database directly, but in the example here, it makes use of AuthorInterface to do that. I might be wrong but doesn't this cause an cycle problem? (service needs interface, interface needs api, api needs service)

`# Class example
class PGMNodeService:

@staticmethod
def get_book(*, id: uuid.UUID) -> Dict:
    book = Book.objects.get(id=id)
    author = AuthorInterface.get_author(id=book.author_id)
    return {
        'name': book.name,
        'author_name': author.name,
    }`
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

No branches or pull requests

1 participant