fix: repair Mermaid diagram syntax errors and add PRD task plan

This commit is contained in:
Siavash Sameni
2026-05-24 08:07:25 +04:00
parent 5b93b2d23e
commit 09ef02c314
11 changed files with 167 additions and 85 deletions

View File

@@ -99,37 +99,37 @@ sequenceDiagram
autonumber
actor S as Seller
actor B as Buyer
participant FE_S as Frontend (seller)
participant FE_B as Frontend (buyer)
participant FE_S as Seller frontend
participant FE_B as Buyer frontend
participant BE as Backend
participant DB as MongoDB
participant N as NotificationService
participant IO as Socket.IO
participant IO as SocketIO
S->>FE_S: Browse /dashboard/seller/marketplace
FE_S->>BE: GET /api/marketplace/purchase-requests?sellerId
BE-->>FE_S: filtered list
S->>FE_S: Open request, click "Send proposal"
S->>FE_S: Fill price, ETA, notes; submit
S->>FE_S: Browse marketplace
FE_S->>BE: GET /api/marketplace/purchase-requests
BE-->>FE_S: filtered request list
S->>FE_S: Open request and send offer
FE_S->>BE: POST /api/marketplace/offers
BE->>DB: ensure no existing offer; check status
BE->>DB: SellerOffer.create({status:"pending"})
opt first offer on the request
BE->>DB: PurchaseRequest.status = "received_offers"
BE->>DB: Validate offer not duplicate
BE->>DB: Validate request status
BE->>DB: Create offer with status pending
opt request has no offers yet
BE->>DB: Set request status to received_offers
end
BE->>N: notifyNewOfferReceived(buyer, requestId, sellerName)
N->>IO: emit user-{buyer} new-notification
BE->>IO: emit seller-{sellerId} 'new-offer'
BE->>N: notifyNewOfferReceived
N->>IO: emit notification to buyer
BE->>IO: emit seller new-offer
BE-->>FE_S: 200 { offer }
IO-->>FE_B: new-notification (buyer's bell icon)
IO-->>FE_B: notify buyer bell icon
B->>FE_B: Open request detail
FE_B->>BE: GET /api/marketplace/offers/request/{id}
BE-->>FE_B: offers[]
alt Buyer accepts via payment
B->>FE_B: Click "Pay" → starts [[Payment Flow - SHKeeper]]
Note over BE,DB: SHKeeper webhook PAID arrives later;<br/>winning offer → accepted, others → rejected
else Buyer negotiates
B->>FE_B: Open chat → [[Negotiation Flow]]
BE-->>FE_B: offers
alt
B->>FE_B: Click pay to finish selected offer
B->>FE_B: SHKeeper webhook handles payment result
else
B->>FE_B: Open chat to negotiate
end
```