a2n-seattle / a2n-seattle/rms-app

Web redesign Phase 6/8: Room reservations (no borrow/return)

未關閉
#338 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
idea priority-medium
主要語言
TypeScript
星號
1
分支
1
平均合併
27 分鐘
30 天內合併 PR
4

描述

# Why?

**As a** user booking a room (not a physical item)
**I want** to reserve a room for a time window without any borrow/return step
**So that** the app supports room bookings, not just checkoutable inventory — rooms don't need to be "picked up" or "returned," just reserved.

# What?

Phase 6 of an 8-phase redesign of `web/` modeled after our internal Retool RMS app (`https://a2nseattle.retool.com/p/rms-alpha/main`). Depends on Phase 2 (#334, overdue query) and Phase 4 (#336, resource detail UI) being in place to modify.

# Design decision (resolved during planning)

Rooms are modeled as `MainSchema.type: "item" | "room"` (new field on the existing schema) rather than a separate `RoomSchema`/table — this lets rooms reuse all existing resource/sub-item/`ScheduleSchema` machinery, minimizing new backend surface. Existing rows default to `type: "item"`.

Scope:
- Backend: add `type: "item" | "room"` to `MainSchema` (`ts-code/src/db/Schemas.ts`); thread it through `AddItem`, `GetItem`, `ListItems` and their `web/lib/api/*` wrappers/types. Existing-row backfill approach (one-time migration vs. read-time fallback treating missing `type` as `"item"`) to be decided during implementation — DynamoDB is schemaless so a read-time fallback is likely simpler and lower-risk.
- Frontend: resource creation/detail UI gains a type selector. For `type === "room"`:
- Hide Borrow/Return actions entirely.
- Exclude the resource from Phase 2's `ListOverdueItems` results (rooms are never "overdue").
- Reserve (including Phase 4's basket/multi-select reserve flow) remains the only available action.
- No new reservation logic needed — reuses all existing `ScheduleSchema`/`CreateReservation` machinery unchanged.
- **No new or modified reservation write path may skip existing double-booking protection** — room reservations must go through the same `ScheduleTable.create`/`validateDate` overlap check as item reservations; do not add a room-specific bypass.

# Testing

Per this repo's testing policy: unit tests for the `type` field threading through `AddItem`/`GetItem`/`ListItems` and the overdue-query exclusion; Jest/RTL for the conditional Borrow/Return UI hiding; Playwright e2e for reserving a room end-to-end (confirming no Borrow/Return UI appears and no overdue alert is ever generated for it).

# Additional context

Part of an 8-phase `web/` redesign series (#333-#337). Phase 7 and 8 are independent of this phase but build on the same resource/dashboard UI it modifies.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

首先檢查 `ts-code/src/db/Schemas.ts` 中的 `MainSchema`,以了解現有結構。這項工作包括新增一個 `type` 欄位、修改 `web/lib/api/*` 中的 API wrappers,以及更新 frontend UI 以有條件地隱藏 Borrow/Return 動作。測試需要為新欄位邏輯撰寫 unit tests,使用 Jest/RTL 測試 UI 變更,並為 room reservation flow 撰寫一個 Playwright e2e 測試。確保沒有任何變更繞過 `ScheduleTable.create` 中現有的 double-booking validation。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
aws
領域
backend, databases, frontend, full-stack
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。