80 lines
3.8 KiB
Markdown
80 lines
3.8 KiB
Markdown
# Product Docs And Real Client Flow Implementation Plan
|
||
|
||
> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||
|
||
**Goal:** Создать один общий документ по приложению и ролям, подготовить рабочие Supabase seed-данные для клиентского приглашения и довести `/delivery/:token` до реального flow.
|
||
|
||
**Architecture:** Документация собирается в одном основном продуктово-ориентированном документе, на который начинает ссылаться `README`. Клиентский flow остаётся построен на `delivery_invitations` и Edge Functions, но приводится к фактическому фронтенд-контракту: фронтенд вызывает functions через Supabase invoke, а seed поднимает один реальный invitation token с рабочими слотами.
|
||
|
||
**Tech Stack:** React 18, Vite, Supabase SQL, Supabase Edge Functions, Vitest.
|
||
|
||
---
|
||
|
||
## Chunk 1: Real Client Invitation Contract
|
||
|
||
### Task 1: Зафиксировать тестами рабочий invitation contract
|
||
|
||
**Files:**
|
||
- Modify: `src/services/deliveryInvitationApi.test.js`
|
||
- Modify or Create: client page test if needed
|
||
|
||
- [ ] **Step 1: Add failing tests for real token flow**
|
||
- [ ] **Step 2: Run targeted tests and confirm failure**
|
||
- [ ] **Step 3: Cover returned delivery date/time and real slot format**
|
||
|
||
### Task 2: Привести Edge Function и frontend API к одному контракту
|
||
|
||
**Files:**
|
||
- Modify: `supabase/functions/get-delivery-invitation/index.ts`
|
||
- Modify: `supabase/functions/confirm-delivery-choice/index.ts`
|
||
- Modify: `src/services/deliveryInvitationApi.js`
|
||
- Modify: `src/pages/ClientDeliveryPage.jsx`
|
||
|
||
- [ ] **Step 1: Support frontend invoke contract in get-delivery-invitation**
|
||
- [ ] **Step 2: Return invitation delivery date/time fields**
|
||
- [ ] **Step 3: Keep confirm-delivery-choice compatible with selected slot data**
|
||
- [ ] **Step 4: Re-run targeted tests and confirm pass**
|
||
|
||
## Chunk 2: Supabase Seed For Demoable Client Flow
|
||
|
||
### Task 3: Подготовить реальный invitation token и слоты в seed
|
||
|
||
**Files:**
|
||
- Modify: `supabase/seed/stage-1-demo.sql`
|
||
|
||
- [ ] **Step 1: Add one known invitation token**
|
||
- [ ] **Step 2: Store stable slot values for tomorrow/after-tomorrow style choices**
|
||
- [ ] **Step 3: Keep seed re-runnable**
|
||
- [ ] **Step 4: Ensure order status matches awaiting client choice**
|
||
|
||
## Chunk 3: One General Product Document
|
||
|
||
### Task 4: Собрать единый общий документ по системе
|
||
|
||
**Files:**
|
||
- Create: `docs/product-overview.md`
|
||
- Modify: `README.md`
|
||
|
||
- [ ] **Step 1: Write the main product document**
|
||
- [ ] **Step 2: Cover goals, roles, scenarios, client flow and Supabase entities**
|
||
- [ ] **Step 3: Link README to the new main document**
|
||
|
||
## Chunk 4: Final Verification
|
||
|
||
### Task 5: Проверить итоговый сценарий
|
||
|
||
**Files:**
|
||
- Reference: `src/pages/ClientDeliveryPage.jsx`
|
||
- Reference: `supabase/seed/stage-1-demo.sql`
|
||
- Reference: `docs/product-overview.md`
|
||
|
||
- [ ] **Step 1: Run targeted tests**
|
||
|
||
Run: `npm test -- src/services/deliveryInvitationApi.test.js src/components/client/DeliveryChoiceFlow.test.jsx src/components/client/DeliverySlotsPicker.test.jsx`
|
||
Expected: PASS
|
||
|
||
- [ ] **Step 2: Run auth/order regression tests**
|
||
|
||
Run: `npm test -- src/context/AuthContext.test.js src/components/auth/OtpLoginForm.test.jsx src/services/orderService.test.js src/components/orders/OrdersTable.test.jsx src/components/orders/OrderDetailPanel.test.jsx src/components/orders/OrderFilters.test.jsx`
|
||
Expected: PASS
|