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

Make docs clearer #202

Merged
merged 43 commits into from
Apr 21, 2022
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5fef8d3
test: add tests
kod-kristoff Mar 22, 2022
338df62
test: add test for sql_entry_uow_creator
kod-kristoff Mar 25, 2022
63cce1d
test: add test for tablename
kod-kristoff Mar 25, 2022
3a499e8
test: add test for tablename
kod-kristoff Mar 25, 2022
e427fc3
test: add test for sql_entries_v2
kod-kristoff Mar 25, 2022
fdaa84e
fix: use entity_id in table_name in sql_entries_v2
kod-kristoff Mar 25, 2022
6c71156
fix: shorten the table name
kod-kristoff Mar 28, 2022
eaa062f
test: fix sql_entries_v2 test
kod-kristoff Mar 28, 2022
1d5c02d
📝 Update release notes
invalid-email-address Mar 28, 2022
1ef3946
feat: extend resource show output
kod-kristoff Mar 25, 2022
85bd349
stub: add delete entry-repo
kod-kristoff Mar 28, 2022
4467e3f
test: add test for sql_entry_uow_creator
kod-kristoff Mar 25, 2022
7c01c25
test: add test for sql_entries_v2
kod-kristoff Mar 25, 2022
89c4975
fix: use entity_id in table_name in sql_entries_v2
kod-kristoff Mar 25, 2022
386f5f6
fix: add num_entities
kod-kristoff Mar 28, 2022
4ddf944
test: fix num_entities in InMemoryRepos
kod-kristoff Mar 29, 2022
4b4096a
📝 Update release notes
invalid-email-address Mar 29, 2022
55723a0
style: use black again
kod-kristoff Mar 29, 2022
3de75d6
build: add black
kod-kristoff Mar 29, 2022
31b2bbc
fix: return result from command_handler
kod-kristoff Mar 29, 2022
ba91843
fix: add set entry repo id
kod-kristoff Mar 29, 2022
edea028
build: remove old deploy
kod-kristoff Mar 30, 2022
a1afef8
stuff
kod-kristoff Apr 1, 2022
8b930b3
📝 Update release notes
invalid-email-address Apr 1, 2022
5512db6
build: prepare release
kod-kristoff Apr 1, 2022
ac3cf60
Bump version: 6.0.19 → 6.0.20
kod-kristoff Apr 1, 2022
a07eb9a
refactor: add logging
kod-kristoff Apr 1, 2022
51e3496
fix: handle long_string
kod-kristoff Apr 1, 2022
8ffdc98
📝 Update release notes
invalid-email-address Apr 1, 2022
88236ca
test: expand tests
kod-kristoff Apr 1, 2022
05bd17c
fix: make karp-cli query output json
kod-kristoff Apr 1, 2022
c0dc725
fix: add export stub
kod-kristoff Apr 4, 2022
e8b34e2
feat: add chunked import
kod-kristoff Apr 6, 2022
077237d
ci: remove caching of poetry
kod-kristoff Apr 6, 2022
f24d6a1
📝 Update release notes
invalid-email-address Apr 6, 2022
1b3156e
refactor: remove unused import
kod-kristoff Apr 6, 2022
f00a13c
fix: print
kod-kristoff Apr 6, 2022
9697a87
fix: display entity_id also
kod-kristoff Apr 6, 2022
f04667e
fix: update
kod-kristoff Apr 7, 2022
230042f
fix: add is_published
kod-kristoff Apr 7, 2022
8da7405
stub: add resource_config
kod-kristoff Apr 9, 2022
394f23b
fix: temporary disable check on sort
kod-kristoff Apr 11, 2022
c06654a
fix: add defaults to schema
kod-kristoff Apr 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: return result from command_handler
  • Loading branch information
kod-kristoff committed Apr 7, 2022
commit 31b2bbcc4f16333aad01cd519337988548c799c4
20 changes: 9 additions & 11 deletions karp/foundation/commands.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import injector


CommandType = TypeVar('CommandType')
CommandType = TypeVar("CommandType")


logger = logging.getLogger(__name__)
@@ -22,20 +22,18 @@ class Command:

class CommandBus(abc.ABC):
@abc.abstractmethod
def dispatch(self, command: Command) -> None:
def dispatch(self, command: Command) -> Any:
raise NotImplementedError


class InjectorCommandBus(CommandBus):
def __init__(self, injector: injector.Injector) -> None:
self._injector = injector
def __init__(self, container: injector.Injector) -> None:
self._container = container

def dispatch(self, command: Command) -> None:
logger.info('Handling command: %s', command)
def dispatch(self, command: Command) -> Any:
logger.info("Handling command: %s", command)
cmd_cls = type(command)
cmd_handler = self._injector.get(
CommandHandler[cmd_cls]) # type: ignore
cmd_handler = self._container.get(CommandHandler[cmd_cls]) # type: ignore

logger.info('Handling command %s with handler %s',
command, cmd_handler)
cmd_handler.execute(command)
logger.info("Handling command %s with handler %s", command, cmd_handler)
return cmd_handler.execute(command)