feat(contracts): p1a endpoint contracts

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-17 17:31:11 +08:00
parent 656498d748
commit 1dae00eaef
8 changed files with 3823 additions and 38 deletions
+1 -1
View File
@@ -1 +1 @@
20
22
@@ -253,8 +253,9 @@ Expected: `src/generated/openapi.d.ts` 生成;redocly 0 错误。
**Files:**
- Modify: `packages/contracts/openapi.yaml`
- Modify: `packages/contracts/tsconfig.json`(exclude src/__tests__,Task 4 审查遗留)、`packages/contracts/package.json`(exports 补 `./package.json`)、根 `package.json` engines(node >=22.12)与 `.nvmrc`(22)——ESM 策略 (a):contracts ESM-only + jest 源码映射(Node 20 已 EOL,2026-09 决策)
- [ ] **Step 1: 补全 P1a 路径与 schema**(字段以技术实施方案 §4/§10 为准):
- [ ] **Step 1: 补全 P1a 路径与 schema**(字段以技术实施方案 §4/§10 为准)。附加要求(Task 4 质量审查遗留):列表响应一律经 allOf 消费 CursorPageMeta;消费后**删除 redocly.yaml 的 no-unused-components 豁免**;auth 三条路径补 400 ErrorResponse;保留 hasMore/nextCursor 成对填充约定:
- `POST /albums`(title 多语言必填、时间、时区默认 Asia/Shanghai、地点、开关默认值 upload/public=true、download=true、original=false、defaultLocale)
- `GET /albums`、`GET /albums/{id}`、`PATCH /albums/{id}`(仅创建者/管理员可写;开关字段独立)
- `POST/GET/DELETE /albums/{id}/members`;`POST /albums/{id}/categories` + `PATCH/DELETE /categories/{id}`
@@ -285,7 +286,7 @@ export interface OutboxEvent<T = unknown> {
}
```
- [ ] **Step 2: 单测**:类型测试——合法 `OutboxEvent{type:'photo.published'}` 编译通过,非法 type 用 `@ts-expect-error` 验证编译期拒绝。
- [ ] **Step 2: 单测**:类型测试——合法 `OutboxEvent{type:'photo.published'}` 编译通过,非法 type 用 `@ts-expect-error` 验证编译期拒绝;**枚举同步测试**(Task 4 审查遗留):断言 `ErrorCode` 与 `components['schemas']['Error']['code']` 的 enum 双向可赋值。
```bash
pnpm --filter @photo/contracts test
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "photo-live",
"private": true,
"packageManager": "pnpm@10.7.1",
"engines": { "node": ">=20" },
"engines": { "node": ">=22.12" },
"scripts": {
"lint": "turbo run lint",
"typecheck": "turbo run typecheck",
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -12,7 +12,8 @@
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./openapi.yaml": "./openapi.yaml"
"./openapi.yaml": "./openapi.yaml",
"./package.json": "./package.json"
},
"scripts": {
"gen": "openapi-typescript openapi.yaml -o src/generated/openapi.d.ts",
-3
View File
@@ -1,5 +1,2 @@
extends:
- recommended
rules:
# 基座阶段 CursorPageMeta 为前瞻定义(Task 5 的列表端点消费),暂时无引用。
no-unused-components: off
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -10,5 +10,6 @@
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"include": ["src"]
"include": ["src"],
"exclude": ["src/__tests__"]
}