Skip to content

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

@TRBF

Description

@TRBF

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,
    }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions