28 lines
883 B
Markdown
28 lines
883 B
Markdown
|
|
# DV-0002:项目与文件系统 – 设计(Design)
|
|||
|
|
|
|||
|
|
## 上下文
|
|||
|
|
`projects.py`、`storage.py`、`project_file_service.py`、`file_vector_sync_service.py`。
|
|||
|
|
|
|||
|
|
## 数据模型
|
|||
|
|
- `projects`(storage_key/owner_id/status/access_pass…)
|
|||
|
|
- `project_members`(role: admin/editor/viewer)
|
|||
|
|
- `document_meta`、`document_vector`
|
|||
|
|
- 细节见 DATABASE.md。
|
|||
|
|
|
|||
|
|
## 存储结构
|
|||
|
|
`STORAGE_ROOT/projects/<storage_key>/` + `_assets/images|files` + 默认 README.md。
|
|||
|
|
|
|||
|
|
## 接口设计
|
|||
|
|
- /api/v1/projects/*(CRUD、my、shared、transfer、members)
|
|||
|
|
- /api/v1/files/{project_id}/tree
|
|||
|
|
|
|||
|
|
## 路径安全
|
|||
|
|
`get_secure_path(storage_key, rel)`:以 project_root 为根,`relative_to` 校验,失败 403。
|
|||
|
|
|
|||
|
|
## 状态与降级
|
|||
|
|
- 权限不足→403;索引同步失败不阻塞文件写(最终一致)。
|
|||
|
|
|
|||
|
|
## 变更影响
|
|||
|
|
- ADR-0006:文件变更触发向量/全文索引进后台同步。
|
|||
|
|
|