@startuml package com.iluwatar.bff { class App { - LOGGER : Logger {static} - USER_ID : String {static} - PRODUCT_ID : String {static} - DEMO_PRICE_USD : double {static} - DEMO_STOCK_LEVEL : int {static} + App() + main(args : String[]) {static} } } package com.iluwatar.bff.bff { interface ClientBff { + getDashboard(userId : String) : T {abstract} } class DesktopBff { - authService : AuthService - orderService : OrderService - supplierService : SupplierService + DesktopBff(auth : AuthService, orders : OrderService, suppliers : SupplierService) + getDashboard(userId : String) : DesktopDashboardResponse } class MobileBff { - MAX_RECENT_ORDERS : int {static} - authService : AuthService - cartService : CartService - orderService : OrderService + MobileBff(auth : AuthService, cart : CartService, orders : OrderService) + getDashboard(userId : String) : MobileDashboardResponse } } package com.iluwatar.bff.dto { class DesktopDashboardResponse { - greeting : String - loyaltyTier : String - orderStatuses : List - supplierStockSummaries : List + DesktopDashboardResponse(greeting : String, loyaltyTier : String, orderStatuses : List, supplierStockSummaries : List) } class MobileDashboardResponse { - greeting : String - cartItemCount : int - cartTotalUsd : double - recentOrderSummaries : List + MobileDashboardResponse(greeting : String, cartItemCount : int, cartTotalUsd : double, recentOrderSummaries : List) } } package com.iluwatar.bff.model { class CartItem { - product : Product - quantity : int + CartItem(product : Product, quantity : int) + lineTotal() : double } class Order { - id : String - productName : String - status : String + Order(id : String, productName : String, status : String) } class Product { - id : String - name : String - priceUsd : double + Product(id : String, name : String, priceUsd : double) } class SupplierRecord { - productId : String - supplierName : String - stockLevel : int + SupplierRecord(productId : String, supplierName : String, stockLevel : int) } class User { - id : String - displayName : String - loyaltyTier : String + User(id : String, displayName : String, loyaltyTier : String) } } package com.iluwatar.bff.service { interface AuthService { + getUser(userId : String) : User {abstract} } interface CartService { + getCart(userId : String) : List {abstract} } interface OrderService { + getOrders(userId : String) : List {abstract} } interface SupplierService { + getSupplierRecords(productId : String) : List {abstract} } } package com.iluwatar.bff.service.impl { class InMemoryAuthService { - users : Map + InMemoryAuthService(userData : Map) + getUser(userId : String) : User } class InMemoryCartService { - cartsByUserId : Map> + InMemoryCartService(carts : Map>) + getCart(userId : String) : List } class InMemoryOrderService { - ordersByUserId : Map> + InMemoryOrderService(orders : Map>) + getOrders(userId : String) : List } class InMemorySupplierService { - recordsByProductId : Map> + InMemorySupplierService(records : Map>) + getSupplierRecords(productId : String) : List } } DesktopBff ..|> ClientBff MobileBff ..|> ClientBff DesktopBff --> "-authService" AuthService DesktopBff --> "-orderService" OrderService DesktopBff --> "-supplierService" SupplierService MobileBff --> "-authService" AuthService MobileBff --> "-cartService" CartService MobileBff --> "-orderService" OrderService InMemoryAuthService ..|> AuthService InMemoryCartService ..|> CartService InMemoryOrderService ..|> OrderService InMemorySupplierService ..|> SupplierService CartItem --> "-product" Product @enduml