Просмотр исходного кода

fix: 修复 Salary schema 字段名称 - baseSalary 改为 basicSalary

- 更新 SalaryCreateInputSchema: baseSalary → basicSalary
- 更新 SalaryUpdateInputSchema: baseSalary → basicSalary
- 更新 SalaryLevel 类型: baseSalary → basicSalary
- 更新 salary-tools.ts 中所有引用
- 设置 provinceId 和 cityId 为必填字段
- 设置 basicSalary 必须大于 0 (positive 而非 nonnegative)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 3 недель назад
Родитель
Сommit
0114456a47

+ 14 - 17
packages/admin-mcp-server/src/schemas/index.ts

@@ -1314,44 +1314,41 @@ export const SalaryCreateInputSchema = z
     provinceId: z
     provinceId: z
       .number()
       .number()
       .int()
       .int()
-      .positive()
-      .optional()
-      .describe('Province ID'),
+      .positive('Province ID must be a positive integer')
+      .describe('Province ID (required)'),
     cityId: z
     cityId: z
       .number()
       .number()
       .int()
       .int()
-      .positive()
-      .optional()
-      .describe('City ID'),
+      .positive('City ID must be a positive integer')
+      .describe('City ID (required)'),
     districtId: z
     districtId: z
       .number()
       .number()
       .int()
       .int()
       .positive()
       .positive()
       .optional()
       .optional()
       .describe('District ID'),
       .describe('District ID'),
-    baseSalary: z
+    basicSalary: z
       .number()
       .number()
-      .nonnegative()
-      .optional()
-      .describe('Base salary'),
+      .positive('Basic salary must be greater than 0')
+      .describe('Basic salary (required)'),
     allowance: z
     allowance: z
       .number()
       .number()
-      .nonnegative()
+      .min(0, 'Allowance cannot be negative')
       .optional()
       .optional()
       .describe('Allowance'),
       .describe('Allowance'),
     insurance: z
     insurance: z
       .number()
       .number()
-      .nonnegative()
+      .min(0, 'Insurance cannot be negative')
       .optional()
       .optional()
       .describe('Insurance'),
       .describe('Insurance'),
     providentFund: z
     providentFund: z
       .number()
       .number()
-      .nonnegative()
+      .min(0, 'Provident fund cannot be negative')
       .optional()
       .optional()
       .describe('Provident fund'),
       .describe('Provident fund'),
     totalSalary: z
     totalSalary: z
       .number()
       .number()
-      .nonnegative()
+      .min(0, 'Total salary cannot be negative')
       .optional()
       .optional()
       .describe('Total salary')
       .describe('Total salary')
   })
   })
@@ -1385,11 +1382,11 @@ export const SalaryUpdateInputSchema = z
       .positive()
       .positive()
       .optional()
       .optional()
       .describe('District ID'),
       .describe('District ID'),
-    baseSalary: z
+    basicSalary: z
       .number()
       .number()
-      .nonnegative()
+      .positive()
       .optional()
       .optional()
-      .describe('Base salary'),
+      .describe('Basic salary'),
     allowance: z
     allowance: z
       .number()
       .number()
       .nonnegative()
       .nonnegative()

+ 5 - 5
packages/admin-mcp-server/src/tools/salary-tools.ts

@@ -33,7 +33,7 @@ function formatSalaryMarkdown(salary: SalaryLevel): string {
     salary.provinceId ? `**Province ID**: ${salary.provinceId}` : null,
     salary.provinceId ? `**Province ID**: ${salary.provinceId}` : null,
     salary.cityId ? `**City ID**: ${salary.cityId}` : null,
     salary.cityId ? `**City ID**: ${salary.cityId}` : null,
     salary.districtId ? `**District ID**: ${salary.districtId}` : null,
     salary.districtId ? `**District ID**: ${salary.districtId}` : null,
-    salary.baseSalary !== null && salary.baseSalary !== undefined ? `**Base Salary**: ¥${salary.baseSalary.toFixed(2)}` : null,
+    salary.basicSalary !== null && salary.basicSalary !== undefined ? `**Base Salary**: ¥${salary.basicSalary.toFixed(2)}` : null,
     salary.allowance !== null && salary.allowance !== undefined ? `**Allowance**: ¥${salary.allowance.toFixed(2)}` : null,
     salary.allowance !== null && salary.allowance !== undefined ? `**Allowance**: ¥${salary.allowance.toFixed(2)}` : null,
     salary.insurance !== null && salary.insurance !== undefined ? `**Insurance**: ¥${salary.insurance.toFixed(2)}` : null,
     salary.insurance !== null && salary.insurance !== undefined ? `**Insurance**: ¥${salary.insurance.toFixed(2)}` : null,
     salary.providentFund !== null && salary.providentFund !== undefined ? `**Provident Fund**: ¥${salary.providentFund.toFixed(2)}` : null,
     salary.providentFund !== null && salary.providentFund !== undefined ? `**Provident Fund**: ¥${salary.providentFund.toFixed(2)}` : null,
@@ -93,7 +93,7 @@ export const salaryListTool = async (args: SalaryListInput) => {
         provinceId: s.provinceId,
         provinceId: s.provinceId,
         cityId: s.cityId,
         cityId: s.cityId,
         districtId: s.districtId,
         districtId: s.districtId,
-        baseSalary: s.baseSalary,
+        basicSalary: s.basicSalary,
         allowance: s.allowance,
         allowance: s.allowance,
         insurance: s.insurance,
         insurance: s.insurance,
         providentFund: s.providentFund,
         providentFund: s.providentFund,
@@ -151,7 +151,7 @@ export const salaryGetTool = async (args: SalaryGetInput) => {
       provinceId: salary.provinceId,
       provinceId: salary.provinceId,
       cityId: salary.cityId,
       cityId: salary.cityId,
       districtId: salary.districtId,
       districtId: salary.districtId,
-      baseSalary: salary.baseSalary,
+      basicSalary: salary.basicSalary,
       allowance: salary.allowance,
       allowance: salary.allowance,
       insurance: salary.insurance,
       insurance: salary.insurance,
       providentFund: salary.providentFund,
       providentFund: salary.providentFund,
@@ -191,7 +191,7 @@ export const salaryCreateTool = async (args: SalaryCreateInput) => {
       provinceId: salary.provinceId,
       provinceId: salary.provinceId,
       cityId: salary.cityId,
       cityId: salary.cityId,
       districtId: salary.districtId,
       districtId: salary.districtId,
-      baseSalary: salary.baseSalary,
+      basicSalary: salary.basicSalary,
       allowance: salary.allowance,
       allowance: salary.allowance,
       insurance: salary.insurance,
       insurance: salary.insurance,
       providentFund: salary.providentFund,
       providentFund: salary.providentFund,
@@ -232,7 +232,7 @@ export const salaryUpdateTool = async (args: SalaryUpdateInput) => {
       provinceId: salary.provinceId,
       provinceId: salary.provinceId,
       cityId: salary.cityId,
       cityId: salary.cityId,
       districtId: salary.districtId,
       districtId: salary.districtId,
-      baseSalary: salary.baseSalary,
+      basicSalary: salary.basicSalary,
       allowance: salary.allowance,
       allowance: salary.allowance,
       insurance: salary.insurance,
       insurance: salary.insurance,
       providentFund: salary.providentFund,
       providentFund: salary.providentFund,

+ 1 - 1
packages/admin-mcp-server/src/types.ts

@@ -390,7 +390,7 @@ export interface SalaryLevel {
   provinceId?: number | null;
   provinceId?: number | null;
   cityId?: number | null;
   cityId?: number | null;
   districtId?: number | null;
   districtId?: number | null;
-  baseSalary?: number | null;
+  basicSalary?: number | null;
   allowance?: number | null;
   allowance?: number | null;
   insurance?: number | null;
   insurance?: number | null;
   providentFund?: number | null;
   providentFund?: number | null;