Skip to content

Commit

Permalink
Merge pull request #21 from snamiki1212/upgrade/clean-arch
Browse files Browse the repository at this point in the history
Upgrade/clean arch
  • Loading branch information
snamiki1212 committed Jun 13, 2023
2 parents ca18a94 + fd7bc0e commit 3339b48
Show file tree
Hide file tree
Showing 77 changed files with 2,068 additions and 1,177 deletions.
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,35 @@ $ APIURL=http://localhost:8080/api zsh e2e/run-api-tests.sh

## Architecture

### Flow from Request to Response
- Clean Architecture
- DI container using Constructor Injection with dynamic dispatch (`/src/di.rs`)

```mermaid
sequenceDiagram
actor Client
participant Middleware as Middleware<br>/middleware/*
participant Controller as Controller<br>/[feature]/api.rs
participant Service as Service<br>/[feature]/service.rs
autonumber
participant Route as Middleware + Route <br><br>/src/app/drivers/{middlewares, routes}
participant Controller as Controller<br><br>/src/app/features/[feature]/controllers.rs
participant Presenter as Presenter<br><br>/src/app/features/[feature]/presenters.rs
participant Usecase as Usecase<br><br>/src/app/features/[feature]/usecases.rs
participant Repository as Repository<br><br>/src/app/features/[feature]/repositories.rs
participant Entity as Entity<br><br>/src/app/features/[feature]/entities.rs
participant DB
Client ->> Middleware: request
Middleware ->> Controller: -
Controller ->> Controller: Assign to Request Object<br>(/[feature]/request.rs)
Controller ->> Service: -
Service ->> DB: -
DB ->> Service: -
Service ->> Controller: -
Controller ->> Controller: Convert into Response Object<br>(/[feature]/response.rs)
Controller ->> Client: response
%% left to right
Client -->> Route: Request
Route ->> Controller: <br>
Controller ->> Usecase: <br>
Usecase ->> Repository: <br>
Repository ->> Entity: <br>
Entity ->> DB: <br>
%% right to left
DB ->> Entity: <br>
Entity ->> Repository: <br>
Repository ->> Usecase: <br>
Usecase ->> Presenter: <br>
Presenter -->> Client: Response
```

## LICENSE
Expand Down
153 changes: 0 additions & 153 deletions src/app/article/api.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/article/mod.rs

This file was deleted.

Loading

0 comments on commit 3339b48

Please sign in to comment.