refactor: remove residual campus and department fields

This commit is contained in:
2026-07-13 12:16:39 +08:00
parent 6396d3e934
commit 0377acd33b
7 changed files with 67 additions and 8 deletions

View File

@@ -0,0 +1,18 @@
import 'reflect-metadata';
import { plainToInstance } from 'class-transformer';
import { validate } from 'class-validator';
import { UpsertProfileDto } from './archive.dto';
describe('UpsertProfileDto retired fields', () => {
it('removes the retired campusLocation field under whitelist validation', async () => {
const dto = plainToInstance(UpsertProfileDto, {
grade: '高三',
campusLocation: '旧校区',
});
await validate(dto, { whitelist: true });
expect(dto).toMatchObject({ grade: '高三' });
expect(dto).not.toHaveProperty('campusLocation');
});
});

View File

@@ -5,7 +5,6 @@ export class UpsertProfileDto {
@IsOptional() @IsString() targetMajor?: string;
@IsOptional() @IsString() subjectDirection?: string;
@IsOptional() @IsString() grade?: string;
@IsOptional() @IsString() campusLocation?: string;
@IsOptional() @IsDateString() profileDate?: string;
@IsOptional() @IsString() notes?: string;
}