Преглед на файлове

📝 docs(entity): update entity creation documentation with routing and menu guidance

- add "注册管理后台路由和菜单" section (step 8) to standard CRUD流程
- add route and menu registration instructions to 自定义复杂CRUD开发流程
- correct step numbering for "前端调用" section from 6 to 7
- provide code examples for route configuration in src/client/admin/routes.tsx
- provide code examples for menu configuration in src/client/admin/menu.tsx
yourname преди 4 месеца
родител
ревизия
5fd5941bc0
променени са 1 файла, в които са добавени 78 реда и са изтрити 9 реда
  1. 78 9
      .roo/rules/11-entity-creation.md

+ 78 - 9
.roo/rules/11-entity-creation.md

@@ -93,7 +93,7 @@
      }).api.v1['your-entities'];
      ```
 
-6. **前端调用**
+### 7. **前端调用**
    - 在页面组件(如`pages_users.tsx`)中:
      - 使用`InferResponseType`提取响应类型
      - 使用`InferRequestType`提取请求类型
@@ -103,6 +103,41 @@
        type CreateRequest = InferRequestType<typeof entityClient.$post>['json'];
        ```
 
+### 8. **注册管理后台路由和菜单**
+    - **注册路由**:在`src/client/admin/routes.tsx`中添加路由配置:
+      ```typescript
+      import YourEntityList from './pages/YourEntityList';
+      import YourEntityDetail from './pages/YourEntityDetail';
+      
+      export const routes = [
+        // ...其他路由
+        {
+          path: '/your-entities',
+          element: <YourEntityList />
+        },
+        {
+          path: '/your-entities/:id',
+          element: <YourEntityDetail />
+        }
+      ];
+      ```
+      
+    - **注册菜单**:在`src/client/admin/menu.tsx`中添加菜单配置:
+      ```typescript
+      import { TableOutlined } from '@ant-design/icons';
+      
+      export const menuItems = [
+        // ...其他菜单项
+        {
+          key: 'your-entities',
+          icon: <TableOutlined />,
+          label: '实体管理',
+          path: '/your-entities'
+        }
+      ];
+      ```
+
+
 ## 自定义复杂CRUD开发流程
 
 当实体需要复杂业务逻辑或非标准CRUD操作时,采用以下完整流程:
@@ -457,14 +492,48 @@
      ```
 
 ### 7. **前端调用**
-   - 在页面组件(如`pages_users.tsx`)中:
-     - 使用`InferResponseType`提取响应类型
-     - 使用`InferRequestType`提取请求类型
-     - 示例:
-       ```typescript
-       type EntityResponse = InferResponseType<typeof entityClient.$get, 200>;
-       type CreateRequest = InferRequestType<typeof entityClient.$post>['json'];
-       ```
+    - 在页面组件(如`pages_users.tsx`)中:
+      - 使用`InferResponseType`提取响应类型
+      - 使用`InferRequestType`提取请求类型
+      - 示例:
+        ```typescript
+        type EntityResponse = InferResponseType<typeof entityClient.$get, 200>;
+        type CreateRequest = InferRequestType<typeof entityClient.$post>['json'];
+        ```
+
+### 8. **注册管理后台路由和菜单**
+    - **注册路由**:在`src/client/admin/routes.tsx`中添加路由配置:
+      ```typescript
+      import YourEntityList from './pages/YourEntityList';
+      import YourEntityDetail from './pages/YourEntityDetail';
+      
+      export const routes = [
+        // ...其他路由
+        {
+          path: '/your-entities',
+          element: <YourEntityList />
+        },
+        {
+          path: '/your-entities/:id',
+          element: <YourEntityDetail />
+        }
+      ];
+      ```
+      
+    - **注册菜单**:在`src/client/admin/menu.tsx`中添加菜单配置:
+      ```typescript
+      import { TableOutlined } from '@ant-design/icons';
+      
+      export const menuItems = [
+        // ...其他菜单项
+        {
+          key: 'your-entities',
+          icon: <TableOutlined />,
+          label: '实体管理',
+          path: '/your-entities'
+        }
+      ];
+      ```
 
 ## 注意事项