Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e37be67
ISSUE #98
Apr 8, 2022
4402a56
ISSUE #98
Apr 8, 2022
45348cc
ISSUE #98
Apr 8, 2022
f084a50
ISSUE #98
Apr 8, 2022
2be00b6
ISSUE #98
Apr 11, 2022
e4a25d3
ISSUE #98
Apr 11, 2022
7d43787
ISSUE #98
Apr 11, 2022
368e914
ISSUE #98
Apr 11, 2022
049ade0
ISSUE #98
Apr 11, 2022
c3987ea
ISSUE #98
Apr 11, 2022
c0f75ef
ISSUE #98
Apr 11, 2022
ca77987
ISSUE #98
Apr 11, 2022
270d92d
ISSUE #98
Apr 11, 2022
7bc3fb3
ISSUE #98
Apr 11, 2022
50e593e
ISSUE #98
Apr 11, 2022
db3a242
ISSUE #98
Apr 11, 2022
3b264aa
ISSUE #98
Apr 11, 2022
5c6815f
ISSUE #98
Apr 11, 2022
ac63685
ISSUE #98
Apr 11, 2022
082810b
ISSUE #98
Apr 11, 2022
2f50420
ISSUE #98
Apr 11, 2022
409c41b
ISSUE #98
Apr 11, 2022
f78eb44
ISSUE #98
Apr 11, 2022
62a060f
ISSUE #98
Apr 12, 2022
9995152
ISSUE #98
Apr 12, 2022
c6146dc
ISSUE #98
Apr 12, 2022
7610ff7
ISSUE #98
Apr 12, 2022
cd86d13
ISSUE #98
Apr 12, 2022
4003cce
ISSUE #98
Apr 12, 2022
36f76ff
ISSUE #98
Apr 12, 2022
68e078b
ISSUE #98
Apr 12, 2022
ab4f044
ISSUE #98
Apr 12, 2022
18ca477
ISSUE #98
Apr 12, 2022
5300dfc
ISSUE #98
Apr 12, 2022
df3fd93
ISSUE #98
Apr 12, 2022
8aeef85
ISSUE #98
Apr 12, 2022
db61ce3
ISSUE #98
Apr 12, 2022
da65029
ISSUE #98
Apr 12, 2022
8d8cd39
ISSUE #98
Apr 13, 2022
38d7031
ISSUE #98
Apr 13, 2022
a483bed
ISSUE #98
Apr 13, 2022
8192b70
ISSUE #98
Apr 13, 2022
743bdd5
ISSUE #98
Apr 13, 2022
ba8d796
ISSUE #98
Apr 13, 2022
3036e92
ISSUE #98
Apr 13, 2022
e532da9
ISSUE #98
Apr 13, 2022
8cf6238
ISSUE #98
Apr 13, 2022
d62c26a
ISSUE #98
Apr 13, 2022
d23f845
Merge remote-tracking branch 'origin/issue-371-add-database-operation…
Apr 13, 2022
906b937
ISSUE #98
Apr 13, 2022
7adb5a1
ISSUE #98
Apr 13, 2022
405f31f
ISSUE #98
Apr 18, 2022
47a0aae
ISSUE #98
Apr 18, 2022
9933c03
ISSUE #98
Apr 18, 2022
9649f2e
ISSUE #98
Apr 18, 2022
f990278
ISSUE #98
Apr 18, 2022
f366197
ISSUE #98
Apr 18, 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
13 changes: 0 additions & 13 deletions .github/workflows/minos-broker-kafka-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ jobs:
working-directory: packages/plugins/minos-broker-kafka

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

zookeeper:
image: wurstmeister/zookeeper:latest
ports:
Expand All @@ -44,10 +34,7 @@ jobs:
KAFKA_ADVERTISED_HOST_NAME: kafka
KAFKA_DELETE_TOPIC_ENABLE: "true"
env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/minos-broker-rabbitmq-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,13 @@ jobs:
defaults:
run:
working-directory: packages/plugins/minos-broker-rabbitmq

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

rabbitmq:
image: rabbitmq:3
ports:
- "5672:5672"

- 5672:5672
env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: rabbitmq
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/minos-database-aiopg-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Publish: minos-database-aiopg"

on:
push:
branches:
- '*.*.x'
paths:
- 'packages/plugins/minos-database-aiopg/**'

jobs:
deploy:
runs-on: ubuntu-latest
container: python:3.9-buster
defaults:
run:
working-directory: packages/plugins/minos-database-aiopg

steps:

- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: make install

- name: Publish package
run: make release
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
64 changes: 64 additions & 0 deletions .github/workflows/minos-database-aiopg-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Test: minos-database-aiopg"

on:
push:
branches:
- main
- '*.*.x'
pull_request:
paths:
- 'packages/plugins/minos-database-aiopg/**'
- 'packages/core/minos-microservice-aggregate/**'
- 'packages/core/minos-microservice-networks/**'
- 'packages/core/minos-microservice-common/**'

jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-buster
defaults:
run:
working-directory: packages/plugins/minos-database-aiopg

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_DATABASES_DEFAULT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: make install

- name: Lint package
run: make lint

- name: Test package with coverage
run: make coverage

- name: Publish coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/plugins/minos-database-aiopg/coverage.xml
fail_ci_if_error: true

- name: Generate documentation
run: make docs

- name: Generate build
run: make dist
17 changes: 0 additions & 17 deletions .github/workflows/minos-http-aiohttp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@ jobs:
run:
working-directory: packages/plugins/minos-http-aiohttp

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/minos-microservice-aggregate-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,6 @@ jobs:
run:
working-directory: packages/core/minos-microservice-aggregate

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/minos-microservice-common-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ jobs:
run:
working-directory: packages/core/minos-microservice-common

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_DATABASES_DEFAULT_HOST: postgres
MINOS_DATABASES_QUERY_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/minos-microservice-cqrs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ jobs:
run:
working-directory: packages/core/minos-microservice-cqrs

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/minos-microservice-networks-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@ jobs:
run:
working-directory: packages/core/minos-microservice-networks

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/minos-router-graphql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@ jobs:
run:
working-directory: packages/plugins/minos-router-graphql

services:
postgres:
image: postgres
env:
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
POSTGRES_DB: order_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

env:
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres

steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ repos:
files: ^packages/plugins/minos-broker-kafka/
language: system

- id: minos-database-aiopg-check
pass_filenames: false
entry: make --directory=packages/plugins/minos-database-aiopg check
name: Check minos-database-aiopg
files: ^packages/plugins/minos-database-aiopg/
language: system

- id: minos-discovery-minos-check
pass_filenames: false
entry: make --directory=packages/plugins/minos-discovery-minos check
Expand Down
2 changes: 1 addition & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sonar.python.version=3.9
sonar.exclusions=tutorials/**
sonar.cpd.exclusions=**/tests/**
sonar.cpd.exclusions=**/tests/**, **/testing/**
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
RootEntity,
)
from .events import (
AiopgEventDatabaseOperationFactory,
DatabaseEventRepository,
Event,
EventDatabaseOperationFactory,
Expand Down Expand Up @@ -59,12 +58,7 @@
Ordering,
)
from .snapshots import (
AiopgSnapshotDatabaseOperationFactory,
AiopgSnapshotQueryDatabaseOperationBuilder,
DatabaseSnapshotReader,
DatabaseSnapshotRepository,
DatabaseSnapshotSetup,
DatabaseSnapshotWriter,
InMemorySnapshotRepository,
SnapshotDatabaseOperationFactory,
SnapshotEntry,
Expand All @@ -73,7 +67,6 @@
)
from .transactions import (
TRANSACTION_CONTEXT_VAR,
AiopgTransactionDatabaseOperationFactory,
DatabaseTransactionRepository,
InMemoryTransactionRepository,
TransactionDatabaseOperationFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def decode_data(cls, decoder: DataDecoder, target: Any, type_: ModelType, **kwar
:param type_: The data type.
:return: A decoded instance.
"""
data_cls = get_args(type_.type_hints["data"])[1]
target = {decoder.build(v, data_cls, **kwargs) for v in target}
target = {str(v["uuid"]): v for v in target}
decoded = decoder.build(target, type_.type_hints["data"], **kwargs)
return cls(decoded, additional_type_hints=type_.type_hints)
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ def _build(self, value: Any, type_: type, ans: dict[str, set[Ref]]) -> None:
self._build_iterable(value.values(), get_args(type_)[1], ans)

elif isinstance(value, Ref):
cls = value.data_cls or get_args(type_)[0]
cls = value.data_cls
if cls is None and len(args := get_args(type_)):
cls = args[0]
if cls is None and len(args := get_args(type_.type_hints["data"])):
cls = args[0]
name = cls.__name__
ans[name].add(value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Event,
)
from .repositories import (
AiopgEventDatabaseOperationFactory,
DatabaseEventRepository,
EventDatabaseOperationFactory,
EventRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
EventRepository,
)
from .database import (
AiopgEventDatabaseOperationFactory,
DatabaseEventRepository,
EventDatabaseOperationFactory,
)
Expand Down
Loading