refactor(students): remove obsolete class id input

This commit is contained in:
2026-07-13 12:20:13 +08:00
parent 0377acd33b
commit effa34434b
2 changed files with 18 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import 'reflect-metadata';
import { validate } from 'class-validator';
import { CreateStudentDto } from './student.dto';
describe('CreateStudentDto relationship boundaries', () => {
it('removes classId because class membership is managed by the classes API', async () => {
const dto = Object.assign(new CreateStudentDto(), {
name: '测试学生',
organizationId: 1,
classId: 9,
});
await validate(dto, { whitelist: true });
expect(dto).toMatchObject({ name: '测试学生', organizationId: 1 });
expect(dto).not.toHaveProperty('classId');
});
});

View File

@@ -38,9 +38,6 @@ export class CreateStudentDto {
@IsOptional()
@IsString()
supervisor?: string;
@IsOptional()
@IsInt()
classId?: number;
}
export class UpdateStudentDto {