Skip to content

Commit

Permalink
fix sequances
Browse files Browse the repository at this point in the history
  • Loading branch information
euhoro committed Jun 19, 2024
1 parent ada170b commit 4b9ad50
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,47 @@ graph TD;
C[RedisInventoryService] --> E[Redis Database];
D[JSONFileInventoryService] --> F[JSON File];
```

### Sequence Diagram for ATM Operations
Withdraw Money

```mermaid
sequenceDiagram
participant User
participant FastAPI
participant ATMService
participant InventoryService
User->>FastAPI: POST /atm/withdrawal
FastAPI->>ATMService: withdraw_money(amount)
ATMService->>InventoryService: acquire_lock()
InventoryService-->>ATMService: lock_acquired
ATMService->>InventoryService: read_inventory()
InventoryService-->>ATMService: inventory_data
ATMService->>InventoryService: write_inventory(updated_inventory)
ATMService->>InventoryService: release_lock()
ATMService-->>FastAPI: withdrawal_result
FastAPI-->>User: withdrawal_result
```
Refill Money

```mermaid
sequenceDiagram
participant User
participant FastAPI
participant ATMService
participant InventoryService
User->>FastAPI: POST /atm/refill
FastAPI->>ATMService: refill_money(money)
ATMService->>InventoryService: acquire_lock()
InventoryService-->>ATMService: lock_acquired
ATMService->>InventoryService: read_inventory()
InventoryService-->>ATMService: inventory_data
ATMService->>InventoryService: write_inventory(updated_inventory)
ATMService->>InventoryService: release_lock()
ATMService-->>FastAPI: refill_result
FastAPI-->>User: refill_result
```

0 comments on commit 4b9ad50

Please sign in to comment.