mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-01 23:43:55 +00:00
refactor(api): split modules under shared/ with API_PREFIX
Move auth and users into folder modules, centralize path constants, and align MSW with endpoint paths in both template apps. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,14 +17,14 @@ vp check --no-fmt
|
||||
pnpm run test:e2e -- e2e/<slug>.spec.ts
|
||||
```
|
||||
|
||||
## 1. Zod and types (`src/api/schemas.ts`)
|
||||
## 1. Zod and types (`src/api/<slug>/schemas.ts`)
|
||||
|
||||
- Define `<Entity>Schema`, `Create<Entity>RequestSchema`, `Update<Entity>RequestSchema` (`Update` = `Create.partial()`).
|
||||
- For list `output`, reuse `PaginatedDataSchema(<Entity>Schema)` (unwrapped `data`; envelope stays in `request.ts`).
|
||||
- Add list query schema (e.g. `List<Entity>QuerySchema`) when the table has filters/pagination.
|
||||
- Export `type <Entity> = z.infer<typeof ...>`.
|
||||
|
||||
## 2. Resource API module (`src/api/<slug>.ts`)
|
||||
## 2. Resource API module (`src/api/<slug>/index.ts`)
|
||||
|
||||
- Export path constants if useful for MSW/docs.
|
||||
- Define APIs with `defineApi` from `@/api/request`: `list` / `create` / `update` / `delete` (and `queryKeys`).
|
||||
|
||||
Reference in New Issue
Block a user