mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
update README with DDD Event flow
This commit is contained in:
parent
7c4355ae7f
commit
2053cd7f05
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,3 +8,6 @@ Cargo.lock
|
|||||||
|
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
|
/rust-lib/flowy-ast
|
||||||
|
/rust-lib/flowy-derive
|
@ -2,6 +2,7 @@
|
|||||||
<module type="CPP_MODULE" version="4">
|
<module type="CPP_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/rust-lib/flowy-ast/src" isTestSource="false" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/build" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/af_protobuf/build" />
|
||||||
@ -26,6 +27,7 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/build" />
|
<excludeFolder url="file://$MODULE_DIR$/app_flowy/packages/flowy_protobuf/build" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/rust-lib/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
@ -167,27 +167,65 @@ The AppFlowy Client consists of lots of modules. Each of them follows the DDD de
|
|||||||
to communication with other module.
|
to communication with other module.
|
||||||
|
|
||||||
```
|
```
|
||||||
Client
|
|
||||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
Client
|
||||||
│ │
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||||
│ User Editor Setting │
|
│ │
|
||||||
│ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
|
│ Module A Module B Module C │
|
||||||
│ │ presentation │ Dependency │ presentation │ │ presentation │ │
|
│ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
|
||||||
│ │ │ Injection │ │ │ │ │
|
│ │ presentation │ Dependency │ presentation │ │ presentation │ │
|
||||||
│ │ application ├───────────────▶│ application │ │ application │ │
|
│ │ │ Injection │ │ │ │ │
|
||||||
│ │ │◀───────────────│ │ │ │ ◉ ◉ ◉ │
|
│ │ application ├───────────────▶│ application │ │ application │ │
|
||||||
│ │ domain │ │ domain │ │ domain │ │
|
│ │ │◀───────────────│ │ │ │ ◉ ◉ ◉ │
|
||||||
│ │ │ │ │ │ │ │
|
│ │ domain │ │ domain │ │ domain │ │
|
||||||
│ │ Infrastructure │ │ Infrastructure │ │ Infrastructure │ │
|
│ │ │ │ │ │ │ │
|
||||||
│ └───────────────────┘ └───────────────────┘ └───────────────────┘ │
|
│ │ Infrastructure │ │ Infrastructure │ │ Infrastructure │ │
|
||||||
│ ▲ │ │
|
│ └───────────────────┘ └───────────────────┘ └───────────────────┘ │
|
||||||
│ │ Dependency Injection │ │
|
│ ▲ │ │
|
||||||
│ └─────────────────────────────────────────────────────────────┘ │
|
│ │ Dependency Injection │ │
|
||||||
│ │
|
│ └─────────────────────────────────────────────────────────────┘ │
|
||||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
│ │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
Let's dig it how can I construct each module. I take `User` module for demonstration.
|
Let's dig it how can I construct each module. I take `User` module for demonstration.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
presentation Application domain Infrastructure
|
||||||
|
|
||||||
|
│
|
||||||
|
│ │
|
||||||
|
7 Data Model
|
||||||
|
┌──────────────────────────────┐ │ ┌────────────────────────┐ │ ┌───────────────────────────┐
|
||||||
|
│ │ │ │ ┌─────────────┐ │ ┌─────▶│ Repository implementation │
|
||||||
|
▼ Bloc │ 2.1 │ │ Aggregate │ │ │ │ └───────────────────────────┘
|
||||||
|
┌─────────────┐ │ ┌─────────────────┴─────┐ │ └─────────────┘ │ │ │ 4
|
||||||
|
│ Widget │ │ ┌────────┐ ┌────────┐ │ │ │ ┌────────┐ │ │ │ ▼
|
||||||
|
└─────────────┘ │ │ │ Event │ │ State │ │───┬────▶│ │ Entity │ │ │ ┌─────────────────────┐
|
||||||
|
│ │ └────────┘ └────────┘ │ │ │ │ └────────┘ │ │ │ │ Unit of Work │
|
||||||
|
│ │ └──────▲────────────────┘ │ │ ┌─────────────────┐ │ │ └─────────────────────┘
|
||||||
|
│ │ │ │ │ │ Value Object │ │ │ │ │ 5
|
||||||
|
└──────────┼────────┘ │ │ └─────────────────┘ │ │ ▼
|
||||||
|
1 │ │ └────────────────────────┘ │ │ ┌─────────────────────┐
|
||||||
|
│ │ ◈ │ │ Persistence Service │
|
||||||
|
│ │ │ contain │ │ └─────────────────────┘
|
||||||
|
│ │ ┌────────────────────┐ │
|
||||||
|
│ │ │ Service │ │ │
|
||||||
|
│ │ └────────────────────┘ │
|
||||||
|
│ 2.2 │ │
|
||||||
|
│ │ ┌───────────────────────┐ │
|
||||||
|
│ └───▶│ Repository interface │ │ │
|
||||||
|
│ └───────────────────────┘ │
|
||||||
|
│ │ │ │
|
||||||
|
│ │ 3 │
|
||||||
|
│ └───────────────┼──┘
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
1. Send event using the bloc. The bloc does not know about the `Widget`. It should communicate through events.
|
||||||
|
2. The bloc dispatching the event to the appropriate handler of the `Domain`
|
||||||
|
1. Conversion between, DTO (Data Transfer Object) to domain model and Domain Model to DTO.
|
||||||
|
2. Handling the business logic using the repository interface
|
||||||
|
3. Repository are used to store the domain model data and calls respective service to finish the jobs.
|
||||||
# Event-Driven
|
# Event-Driven
|
Loading…
Reference in New Issue
Block a user