refactor(rooms): remove dorm gender restrictions
This commit is contained in:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user