範圍:假資料結構、前端 Mock 層、文件、腳本、清理;不含 Java Entity / REST Controller。
進度:完成後將- [ ]改為- [x]。
相關規格:data-integration-spec.md
現行 DDL:../docs/latest_schema.sql· 導覽:../docs/database-schema-guide.md· ENUM:../docs/schema-enums.md
備註:本清單為歷史整合勾選;建庫請以latest_schema.sql為準(不再使用已移除的schema.sql/database-er.md)。
| 項目 | 決策 |
|---|---|
| 會員訂單查詢 | 刪 customers.orders[] / rentals[],改 customerId FK |
| 租借庫存權威 | admin/rental-skus.json → 同步衍生 camp-equipment.json |
| 預約窗口 | bookingWindowDays = 90 |
| 折價券 | 會員中心僅 birthday + firstPurchase;結帳可輸入 promotion |
| 訂單/預約 | 下單當下寫快照(B) + 保留 productId / variantId 等 FK |
| 會員登入 | 僅 OAuth,無 password |
| 部落格 | productId 統一 P001 格式、camelCase |
| 靜態內容 | FAQ、夥伴營地、rental-guide 不進 DB |
plans/data-integration-spec.md(90 天、刪白名單、快照、券規則、rental-skus 權威)docs/database-er.md(對齊 /data/**,刪 users.json / userId / admin/data/ 舊描述)data/customers/customers.jsonorders[] 欄位rentals[] 欄位password 欄位(OAuth only)shippingAddress 結構與 js/shipping-address.js 一致firstPurchaseUsed、birthday 存在(券資格)data/marketing/articles.jsoncontent[].productId:prod-xxx → Pxxx(例 prod-001 → P001)relatedProducts[] 同上productId 存在於 catalog/products.jsondata/admin/booking-policy.jsonbookingWindowDays: 90occupyingStatuses:pending, confirmed, completedjs/booking-availability.js 的 DEFAULT_POLICY.bookingWindowDays 為 90data/commerce/orders.jsoncustomerId(非 userId)buyerName、address 為下單當下值items[].specLabel 分隔符為 ` / (非 、`)variantId + sku[x] 1-16 status 僅用:unshipped |
shipped |
completed |
returned |
createdAt(camelCase)data/commerce/camp-bookings.jsonbookingInfo 快照(campgroundName、region 等)selectedRentals[] 補齊 rentalSkuId, productId, variantId, sku, specLabelspecLabel 為 ` / ` 分隔[x] 1-21 status 僅用:pending |
confirmed |
completed |
cancelled |
submittedAt(camelCase)data/catalog/products.jsonname 不含規格(規格在 variants[].label)variants[].id = sku(例 v-P001-0)variants[].branch;totalStock / branch 標為衍生(腳本重算)interestTags(camelCase)image + images[](非 thumbnail)data/admin/rental-skus.json)rental-skus(庫存唯一寫入來源)variants[].camp 對齊 C001–C009camp[].campgroundId + name 與 campgrounds.json 一致sync-rental-listings.cjs(skus → camp-equipment.stock)camp-equipment.json 標為唯讀衍生(禁止手改 stock)data/promotions/coupons.json[x] 1-33 每筆有 category:promotion |
birthday |
firstPurchase |
type / minOrder 補齊或文件化預設(fixed)YURUIHBD → birthday;YRUIFIRST → firstPurchasecategory: promotion(結帳用,不進會員中心列表)data/admin/reviews.jsoncustomerId + productId + variantIdorderId 能補則補(可 null)productName 快照,關聯以 FK 為準data/admin/movement.jsoncreated_at → createdAt(全檔 camelCase)items[] 陣列結構items[] 補 productId,保留 productName 快照campgrounds.json:campgroundId、zoneId、totalSites 等 camelCasezone-blocks.json / campground-closures.json FK 對齊營區min-stock.json 對齊商品與租借 targetbranches.json / brands.json 維持現狀(靜態行銷)admin/data/**(內容已併入 /data/**;過渡 _archive 亦已移除)data/admin/equipment-id-map.json(遷移完成後)migrate-data-integration.cjs 等)標記 deprecatedgrep 確認執行時無程式讀 admin/data/grep 確認無程式讀根目錄舊扁平 data/*.jsonjs/components/member-center.jsfilterByCustomerIds() 白名單;訂單改 customerId 篩選booking.customerId === uiddataBasePath / json() 舊路徑(若已無引用)aliases 僅保留一版相容或移除)api-mock.js:getAvailable 僅回 birthday + firstPurchasecoupons.js:結帳 validateCoupon 仍驗證全池(含 promotion)order.coupons[] 或等同結構)API.orders.create 寫入完整快照(buyerName、address、items 全欄位)BookingAPI.createBooking + buildBookingPayload 寫入完整預約快照customers.json 即可出現在會員中心bookingCart localStorage snake_case → 已升級為 camelCase(見 3-13)buildBookingPayload() 持久化僅 camelCaseblog-detail.js / blog.js 經 DataPaths 讀取productId 使用 P001 格式enrichProduct:rating / salesCount / totalStock 標為 API 衍生,不寫回 JSONbuildSpecLabel 統一 ` / `;新單據皆用此規則admin/js/products.js:租借庫存寫入 rental-skus 並觸發 listing 同步admin/js/movement.js:讀寫 createdAt(相容 created_at 可保留一版)admin/js/orders.js:以 orders.customerId 為準,不從 customers.orders 反查js/booking-availability.js:DEFAULT_POLICY.bookingWindowDays = 90admin/scripts/validate-data-fk.cjs(articles productId、無 customers.orders[]、specLabel)admin/scripts/sync-rental-listings.cjs(rental-skus → camp-equipment.stock)normalize-spec-labels.cjs(、 → ` / `)fix-articles-product-ids.cjs(prod-xxx → Pxxx)run-variant-integration-v2.cjs 註解(camp-equipment 為衍生輸出)package.json 登錄 validate:data、sync:listings 等 scriptsnode admin/scripts/validate-data-fk.cjs 通過node admin/scripts/sync-rental-listings.cjs 通過(建立後)customerId 顯示(不靠白名單)art-001:內嵌商品卡片有內容YURUIKAMP20 可折抵;會員中心列表看不到該碼node admin/scripts/validate-data-fk.cjs
node admin/scripts/sync-rental-listings.cjs # 待建立
pages/faq.html + booking/pages/booking-faq.html 維持 HTML 靜態js/pages/branches.js 的 PARTNER_DATA 維持靜態booking/pages/rental-guide.html 維持靜態mockOrders, mockBookings, mockReviews, mockCustomerOverlay, mockCampgroundClosures, adminEmployeesmockCustomerOverlay 語意對齊未來 PATCH /customers/:idMockStorageMerge 為暫時層(後端以 DB transaction 取代)AdminAPI.configure({ useBackend: true }) 接入點現行取代:完整 DDL 已收斂為
docs/latest_schema.sql;導覽為database-schema-guide.md。舊檔名schema.sql/database-er.md/snapshot-fields.md已不再維護。
docs/latest_schema.sqldocs/schema-enums.md(status / category 枚舉;對齊 latest_schema)docs/database-documents/(訂單/預約等章節)latest_schema.sql/database-schema-guide.md)customers.orders[]customers.rentals[]customers.passwordadmin/data/** 殘留equipment-id-map.json(遷移後)camp-equipment.stockproducts.totalStock / products.branch(改衍生)articles 的 prod-xxx 格式movement.created_atdatabase-er.md 舊路徑描述| 週次 | 內容 |
|---|---|
| Week 1 | Phase 0 + Phase 1(1-1~1-8, 1-9~1-11, 1-33~1-36)+ Phase 2 |
| Week 2 | Phase 1 其餘 + Phase 3(3-1~3-10 優先) |
| Week 3 | Phase 3 其餘 + Phase 4 |
| Week 4 | Phase 5 + Phase 6 + Phase 7 |
customers.orders[] / rentals[] + 改 member-center.js(1-1, 1-2, 3-1, 3-2)articles.json productId(1-6, 1-7, 1-8)booking-policy + DEFAULT_POLICY → 90 天(1-9, 1-11, 3-21)sync-rental-listings.cjs(1-31, 4-2)admin/data/(2-1)| Phase | 總項 | 完成 |
|---|---|---|
| 0 | 3 | 3 |
| 1 | 46 | 46 |
| 2 | 5 | 5 |
| 3 | 21 | 21 |
| 4 | 12 | 12 |
| 5 | 4 | 4 |
| 6 | 4 | 4 |
| 7 | 5 | 5 |
| 刪除清單 | 11 | 11 |
| 最優先 | 5 | 5 |
最後更新:2026-07-09(Phase 0~7 完成;admin/data/ 與 _archive/pre-integration/ 已自工作區移除)