Przeglądaj źródła

🐛 fix(auth): 移除不必要的类型断言并扩展JWT载荷类型

- 在人才就业信息集成测试中移除对UserType.TALENT的`as any`类型断言,使用正确的类型
- 在shared-types的JWTPayload接口中添加personId和userType字段,以支持用户身份关联
yourname 3 tygodni temu
rodzic
commit
e013254ab4

+ 2 - 2
allin-packages/order-module/tests/integration/talent-employment.integration.test.ts

@@ -95,7 +95,7 @@ describe('人才就业信息API集成测试 - 故事015.005', () => {
       roles: [{ name: 'talent' }]
     }, {
       personId: testDisabledPerson.id,
-      userType: UserType.TALENT as any
+      userType: UserType.TALENT
     });
 
     // 创建测试平台
@@ -213,7 +213,7 @@ describe('人才就业信息API集成测试 - 故事015.005', () => {
         username: userWithoutPerson.username,
         roles: [{ name: 'talent' }]
       }, {
-        userType: UserType.TALENT as any
+        userType: UserType.TALENT
       });
 
       const response = await client.employment.status.$get(undefined, {

+ 2 - 0
packages/shared-types/src/index.ts

@@ -101,6 +101,8 @@ export interface JWTPayload {
   roles?: string[];
   openid?: string;
   tenantId?: number; // 租户ID,用于多租户场景
+  personId?: number; // 关联人员ID(如残疾人ID)
+  userType?: UserType; // 用户类型
 }
 
 // Hono 认证上下文类型