Преглед изворни кода

✨ feat(role): 完善角色创建功能

- 在Users.tsx中添加CreateRoleRequest类型定义,支持角色创建请求类型检查
- 修改CreateRoleDto,移除createdAt和updatedAt字段,避免创建角色时传入时间戳

♻️ refactor(role): 优化角色数据传输对象定义

- 调整RoleSchema导出的CreateRoleDto结构,仅保留必要的创建字段
yourname пре 5 месеци
родитељ
комит
8ff79dbe2f
2 измењених фајлова са 2 додато и 1 уклоњено
  1. 1 0
      src/client/admin/pages/Users.tsx
  2. 1 1
      src/server/modules/users/role.entity.ts

+ 1 - 0
src/client/admin/pages/Users.tsx

@@ -10,6 +10,7 @@ import type { InferResponseType, InferRequestType } from 'hono/client';
 
 type UserListResponse = InferResponseType<typeof userClient.$get, 200>;
 type RoleListResponse = InferResponseType<typeof roleClient.$get, 200>;
+type CreateRoleRequest = InferRequestType<typeof roleClient.$post>['json'];
 type UserDetailResponse = InferResponseType<typeof userClient[':id']['$get'], 200>;
 type CreateUserRequest = InferRequestType<typeof userClient.$post>['json'];
 type UpdateUserRequest = InferRequestType<typeof userClient[':id']['$put']>['json'];

+ 1 - 1
src/server/modules/users/role.entity.ts

@@ -24,7 +24,7 @@ export const RoleSchema = z.object({
   updatedAt: z.date().openapi({ description: '更新时间' })
 });
 
-export const CreateRoleDto = RoleSchema.omit({ id: true });
+export const CreateRoleDto = RoleSchema.omit({ id: true , createdAt: true, updatedAt: true });
 export const UpdateRoleDto = RoleSchema.partial();
 
 @Entity({ name: 'role' })