Multiple implementations of the same back-end application. The aim is to provide quick, side-by-side comparisons of different technologies (languages, frameworks, libraries) while preserving consistent business logic across all implementations.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.7 KiB

Add item sequence

sequenceDiagram
    participant Client as HTTP Client
    participant Middleware as HttpJwtMiddleware
    participant Server as HttpServer
    participant Controller as StoreController
    participant AuthService as IAuthService
    participant UseCase as AddItem
    participant Clock as ITimeProvider
    participant Policy as ItemExpirationPolicy
    participant OrderService as IOrderService
    participant HttpClient as HttpOrderService
    participant Repo as IItemRepository

    Client->>Server: POST /items with JWT
    Server->>Middleware: Validate token
    Middleware-->>Server: token valid
    Server->>Controller: Forward request

    Controller->>AuthService: Extract user ID from token
    AuthService-->>Controller: User ID

    Controller->>Controller: Parse request body to Item
    Controller->>UseCase: execute(item)

    UseCase->>Clock: now()
    Clock-->>UseCase: current time

    UseCase->>Policy: isExpired(item, currentTime)
    Policy-->>UseCase: boolean

    alt Item is expired
        UseCase->>OrderService: orderItem(item)
        OrderService->>HttpClient: POST to order URL
        HttpClient-->>OrderService: Response
        OrderService-->>UseCase: void
    end

    UseCase->>Repo: save(item)
    Repo->>Repo: Persist to file storage
    Repo-->>UseCase: Item ID

    UseCase-->>Controller: Item ID
    Controller->>Controller: Build success response
    Controller-->>Client: 201 Created with Item ID

    alt Error occurs
        UseCase-->>Controller: Exception
        Controller->>Controller: Build error response
        Controller-->>Client: 4xx/5xx error
    end

    alt Authentication fails
        Middleware-->>Client: 401 Unauthorized
    end