import { createCrudRoutes } from '@/server/utils/generic-crud.routes';
import { SubmissionRecords } from '@/server/modules/submission/submission-records.entity';
import { SubmissionRecordsSchema, CreateSubmissionRecordsDto, UpdateSubmissionRecordsDto } from '@/server/modules/submission/submission-records.schema';
import { authMiddleware } from '@/server/middleware/auth.middleware';

const submissionRecordsRoutes = createCrudRoutes({
  entity: SubmissionRecords,
  createSchema: CreateSubmissionRecordsDto,
  updateSchema: UpdateSubmissionRecordsDto,
  getSchema: SubmissionRecordsSchema,
  listSchema: SubmissionRecordsSchema,
  searchFields: ['classroomNo', 'userId', 'code'],
  relations: ['user'], // 添加用户关联查询
  middleware: [authMiddleware]
});

export default submissionRecordsRoutes;