ソースを参照

🔧 chore(api): 删除用户创建接口文件

- 移除src/server/api/users/post.ts文件
- 清理用户创建相关路由代码
yourname 2 ヶ月 前
コミット
bb140f81ff
1 ファイル変更0 行追加61 行削除
  1. 0 61
      src/server/api/users/post.ts

+ 0 - 61
src/server/api/users/post.ts

@@ -1,61 +0,0 @@
-import { createRoute, OpenAPIHono } from '@hono/zod-openapi';
-import { UserService } from '../../modules/users/user.service';
-import { authMiddleware } from '../../middleware/auth.middleware';
-import { ErrorSchema } from '../../utils/errorHandler';
-import { AppDataSource } from '../../data-source';
-import { AuthContext } from '../../types/context';
-import { UserSchema, CreateUserDto } from '@/server/modules/users/user.schema';
-
-const userService = new UserService(AppDataSource);
-
-const createUserRoute = createRoute({
-  method: 'post',
-  path: '/',
-  middleware: authMiddleware,
-  request: {
-    body: {
-      content: {
-        'application/json': {
-          schema: CreateUserDto
-        }
-      }
-    }
-  },
-  responses: {
-    201: {
-      description: '创建成功',
-      content: {
-        'application/json': {
-          schema: UserSchema
-        }
-      }
-    },
-    400: {
-      description: '输入数据无效',
-      content: {
-        'application/json': {
-          schema: ErrorSchema
-        }
-      }
-    },
-    500: {
-      description: '服务器错误',
-      content: {
-        'application/json': {
-          schema: ErrorSchema
-        }
-      }
-    }
-  }
-});
-
-const app = new OpenAPIHono<AuthContext>().openapi(createUserRoute, async (c) => {
-  try {
-    const data = c.req.valid('json');
-    const user = await userService.createUser(data);
-    return c.json(user, 201);
-  } catch (error) {
-    return c.json({ code: 500, message: '服务器错误' }, 500);
-  }
-});
-export default app;