feat(contracts): p1a endpoint contracts
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -253,8 +253,9 @@ Expected: `src/generated/openapi.d.ts` 生成;redocly 0 错误。
|
|||||||
|
|
||||||
**Files:**
|
**Files:**
|
||||||
- Modify: `packages/contracts/openapi.yaml`
|
- 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)
|
- `POST /albums`(title 多语言必填、时间、时区默认 Asia/Shanghai、地点、开关默认值 upload/public=true、download=true、original=false、defaultLocale)
|
||||||
- `GET /albums`、`GET /albums/{id}`、`PATCH /albums/{id}`(仅创建者/管理员可写;开关字段独立)
|
- `GET /albums`、`GET /albums/{id}`、`PATCH /albums/{id}`(仅创建者/管理员可写;开关字段独立)
|
||||||
- `POST/GET/DELETE /albums/{id}/members`;`POST /albums/{id}/categories` + `PATCH/DELETE /categories/{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
|
```bash
|
||||||
pnpm --filter @photo/contracts test
|
pnpm --filter @photo/contracts test
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "photo-live",
|
"name": "photo-live",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@10.7.1",
|
"packageManager": "pnpm@10.7.1",
|
||||||
"engines": { "node": ">=20" },
|
"engines": { "node": ">=22.12" },
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "turbo run lint",
|
"lint": "turbo run lint",
|
||||||
"typecheck": "turbo run typecheck",
|
"typecheck": "turbo run typecheck",
|
||||||
|
|||||||
+1784
-13
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,8 @@
|
|||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./dist/index.js"
|
||||||
},
|
},
|
||||||
"./openapi.yaml": "./openapi.yaml"
|
"./openapi.yaml": "./openapi.yaml",
|
||||||
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"gen": "openapi-typescript openapi.yaml -o src/generated/openapi.d.ts",
|
"gen": "openapi-typescript openapi.yaml -o src/generated/openapi.d.ts",
|
||||||
|
|||||||
@@ -1,5 +1,2 @@
|
|||||||
extends:
|
extends:
|
||||||
- recommended
|
- recommended
|
||||||
rules:
|
|
||||||
# 基座阶段 CursorPageMeta 为前瞻定义(Task 5 的列表端点消费),暂时无引用。
|
|
||||||
no-unused-components: off
|
|
||||||
|
|||||||
+2030
-16
File diff suppressed because it is too large
Load Diff
@@ -10,5 +10,6 @@
|
|||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"],
|
||||||
|
"exclude": ["src/__tests__"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user