import { createCrudRoutes } from '@/server/utils/generic-crud.routes';
import { authMiddleware } from '@/server/middleware/auth.middleware';
import { ActivityEntity } from '@/server/modules/activities/activity.entity';
import { createActivitySchema, updateActivitySchema, getActivitySchema, activityListResponseSchema } from '@/server/modules/activities/activity.schema';

// 创建活动管理API路由
export const activitiesRoutes = createCrudRoutes({
  entity: ActivityEntity,
  createSchema: createActivitySchema,
  updateSchema: updateActivitySchema,
  getSchema: getActivitySchema,
  listSchema: activityListResponseSchema,
  searchFields: ['name', 'description'],
  relations: ['routes'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});