import { createCrudRoutes } from '@d8d/shared-crud';
import { authMiddleware } from '@d8d/auth-module';
import { SalaryLevel } from '../entities/salary-level.entity';
import { SalaryLevelSchema, CreateSalarySchema, UpdateSalarySchema } from '../schemas/salary.schema';

export const salaryCrudRoutes = createCrudRoutes({
  entity: SalaryLevel,
  createSchema: CreateSalarySchema,
  updateSchema: UpdateSalarySchema,
  getSchema: SalaryLevelSchema,
  listSchema: SalaryLevelSchema,
  searchFields: ['provinceId', 'cityId', 'districtId'],
  middleware: [authMiddleware],
  readOnly: true, // 设置为只读，因为创建、更新、删除操作通过自定义路由处理
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});