forked from wangziqi/gongxue-base
refactor(students): remove obsolete class id input
This commit is contained in:
18
apps/server/src/students/dto/student.dto.spec.ts
Normal file
18
apps/server/src/students/dto/student.dto.spec.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
@@ -38,9 +38,6 @@ export class CreateStudentDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
supervisor?: string;
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
classId?: number;
|
||||
}
|
||||
|
||||
export class UpdateStudentDto {
|
||||
|
||||
Reference in New Issue
Block a user