diff --git a/DESIGN.md b/DESIGN.md index edb018c..a02ea74 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -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 +``` \ No newline at end of file