Repository navigation
feat(N8): 乘客端行程 API 帶 stops+ride.stop_updated 進度事件 - #41
Merged
Merged
Conversation
缺口是 App 端回報的:乘客送得出 stops(建單時),卻看不到自己排的行程—— CustomerRideView 只加司機聯絡資訊,帶 stops 的只有 DriverRideView, 乘客端因此做不出多停靠點地圖與行程進度。 1. CustomerRideView 加 Stops(omitempty),customer active 與單筆查詢都帶。 形狀與 DriverRideView.Stops 完全相同,App 端兩邊共用同一套解析。 單筆查詢也帶,歷史行程/遺失物協尋回頭查才看得到當時全程。 讀 stops 失敗不擋整筆查詢;未注入 stops repo 時查詢照樣成功。 2. 新事件 ride.stop_updated:司機標記到達/跳過時推給本趟乘客, payload 帶整趟 stops 而非單一 stop——乘客端收到直接覆蓋即可, 不必套用差異,漏收一則也不會讓狀態永遠對不上。 標記失敗(重複標記 409)時不推事件,否則乘客收到「進度更新」卻什麼都沒變。 publisher 未注入時標記照樣成功。 驗收:go test ./internal/service/ 新增 9 項全綠(含反向確認:把乘客路徑改回 withDriverContact 會 FAIL)、events/handler 測試綠;docker live E2E—— 乘客建 2 人 4 站訂單 → active 回 4 站 → 司機接單 → arrive 第 1 站 → 乘客 WS 即時收到 ride.stop_updated(整趟+arrived_at)→ skip 第 2 站 → active 顯示「已到達/已跳過/待處理/待處理」,與司機端 active 欄位形狀一致。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
為什麼
做 fleet-app 乘客端「多停靠點地圖/行程進度」時發現後端擋住了:乘客建單送得出 stops,卻拿不回來——
CustomerRideView只加了司機聯絡資訊,帶 stops 的只有DriverRideView。改了什麼
CustomerRideView加Stops(omitempty),GET /api/customer/rides/active與GET /api/customer/rides/:id都帶。DriverRideView.Stops完全相同(E2E 實跑比對欄位集合一致),App 端兩邊共用同一套解析。ride.stop_updated:司機標記到達/跳過時推給本趟乘客。單點訂單的回應形狀一個位元組都沒變(
omitempty),舊版 App 不受影響。驗收
go test ./internal/service/新增 9 項全綠(testcontainers 真的跑起來,不是 skip),含反向確認:把乘客路徑改回withDriverContact→預期帶 2 個停靠點,得到 0FAIL。go test ./internal/events/ ./internal/handler/綠。arrive第 1 站 → 乘客 WS 即時收到ride.stop_updated(帶整趟+arrived_at)→skip第 2 站 → 乘客 active 顯示「已到達/已跳過/待處理/待處理」,欄位與司機端 active 一致。後續
App 端(fleet-app)接著做
CustomerRide.stops解析、地圖多停靠點 marker 與行程進度 UI。🤖 Generated with Claude Code