feat: extend staging seed data
This commit is contained in:
92
docs/plan.md
92
docs/plan.md
@@ -0,0 +1,92 @@
|
||||
# Implementation Plan: Staging Seed Data
|
||||
|
||||
**Branch**: `main` | **Date**: 2026-01-26 | **Spec**: `docs/staging_smoke_test.md`
|
||||
**Input**: staging 冒烟测试需要快速准备基础数据。
|
||||
|
||||
**Note**: 本计划遵循 `docs/templates/plan-template.md`。
|
||||
|
||||
## Summary
|
||||
|
||||
扩展 Go seed 命令,生成 staging 冒烟测试所需的最小数据集(租户、用户、超管、内容、订单、优惠券、通知等),确保前后台关键页面可快速验证。
|
||||
|
||||
## Technical Context
|
||||
|
||||
**Language/Version**: Go 1.22
|
||||
**Primary Dependencies**: Fiber, GORM-Gen
|
||||
**Storage**: PostgreSQL + Redis
|
||||
**Testing**: `go test ./...`
|
||||
**Target Platform**: Linux server (staging)
|
||||
**Project Type**: Web application (backend + frontend)
|
||||
**Performance Goals**: N/A
|
||||
**Constraints**: 不修改生成文件,Service/Controller 规范保持不变
|
||||
**Scale/Scope**: 最小可用冒烟数据
|
||||
|
||||
## Constitution Check
|
||||
|
||||
- 遵循 `backend/llm.txt` 规则(不改生成文件、中文注释、服务层规范)。
|
||||
- seed 逻辑仅在 `backend/app/commands/seed/seed.go` 修改。
|
||||
|
||||
## Project Structure
|
||||
|
||||
### Documentation (this feature)
|
||||
|
||||
```text
|
||||
docs/
|
||||
└── plan.md
|
||||
```
|
||||
|
||||
### Source Code (repository root)
|
||||
|
||||
```text
|
||||
backend/
|
||||
└── app/commands/seed/seed.go
|
||||
```
|
||||
|
||||
**Structure Decision**: 使用现有 seed 命令注入 staging 数据。
|
||||
|
||||
## Plan Phases
|
||||
|
||||
### Phase 1: 数据范围确认
|
||||
- 明确需覆盖的冒烟用例与最小数据集。
|
||||
|
||||
### Phase 2: Seed 扩展实现
|
||||
- 增加超管用户、租户成员、订单与内容访问等基础数据。
|
||||
- 确保幂等运行(重复执行不报错)。
|
||||
|
||||
### Phase 3: 文档与验证
|
||||
- 记录 seed 运行方式与输出数据说明。
|
||||
|
||||
## Tasks
|
||||
|
||||
**Format**: `[ID] [P?] [Story] Description`
|
||||
|
||||
### Phase 1: Foundational
|
||||
- [x] T001 [US0] 明确冒烟必需数据项(用户/租户/内容/订单/通知)
|
||||
|
||||
### Phase 2: Seed 扩展
|
||||
- [x] T010 [US1] 创建超管用户与角色
|
||||
- [x] T011 [US1] 创建租户成员与权限关系
|
||||
- [x] T012 [US1] 创建订单、订单项、内容访问记录
|
||||
- [x] T013 [US1] 创建通知模板/系统通知
|
||||
|
||||
### Phase 3: Docs
|
||||
- [x] T020 [US2] 更新 seed 说明文档/输出示例
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Phase 1 → Phase 2 → Phase 3。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- `go run ./backend/main.go seed` 可成功生成数据。
|
||||
- seed 后 staging 冒烟清单主要页面可打开并有数据展示。
|
||||
- 重复运行 seed 不产生致命错误。
|
||||
|
||||
## Risks
|
||||
|
||||
- 真实 staging 数据冲突(唯一索引)。
|
||||
- 订单/访问数据缺失导致部分页面空白。
|
||||
|
||||
## Complexity Tracking
|
||||
|
||||
无。
|
||||
|
||||
Reference in New Issue
Block a user