refactor(rooms): remove dorm gender restrictions

This commit is contained in:
2026-07-13 15:19:09 +08:00
parent aa1ed7db56
commit f98c0ccaa8
12 changed files with 61 additions and 166 deletions

View File

@@ -114,13 +114,7 @@ export class RoomsService {
}
async update(id: number, dto: UpdateRoomDto) {
const room = await this.findOne(id);
if (Object.prototype.hasOwnProperty.call(dto, 'gender') && dto.gender !== room.gender) {
const activeCount = await this.occRepo.count({
where: { roomId: id, checkOutDate: IsNull() },
});
if (activeCount > 0) throw new BadRequestException('该宿舍有在住人员,无法修改宿舍性别');
}
await this.findOne(id);
await this.repo.update(id, dto);
return this.repo.findOne({ where: { id } });
}
@@ -302,7 +296,6 @@ export class RoomsService {
roomType?: string;
rentalCategory?: string;
monthlyRate?: number;
gender?: '男' | '女';
}[],
) {
let imported = 0;
@@ -328,7 +321,6 @@ export class RoomsService {
roomType: row.roomType || parsed.roomType || undefined,
rentalCategory: row.rentalCategory || undefined,
monthlyRate: row.monthlyRate ?? undefined,
gender: row.gender ?? undefined,
}),
);
imported++;