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

@@ -67,7 +67,6 @@ export class RoomsController {
{ header: '宿舍类型', key: 'roomType', width: 12 },
{ header: '租赁类型(long/short)', key: 'rentalCategory', width: 18 },
{ header: '月租金', key: 'monthlyRate', width: 10 },
{ header: '宿舍性别(男/女)', key: 'gender', width: 18 },
];
ws.addRow({
roomNumber: '4-102',
@@ -77,7 +76,6 @@ export class RoomsController {
roomType: '四人间',
rentalCategory: 'long',
monthlyRate: 800,
gender: '男',
});
ws.addRow({
roomNumber: '2-201',
@@ -87,7 +85,6 @@ export class RoomsController {
roomType: '单人间',
rentalCategory: 'short',
monthlyRate: 0,
gender: '女',
});
res.setHeader(
'Content-Type',
@@ -113,7 +110,6 @@ export class RoomsController {
{ header: '宿舍类型', key: 'roomType', width: 12 },
{ header: '额定人数', key: 'capacity', width: 10 },
{ header: '当前入住', key: 'currentCount', width: 10 },
{ header: '性别', key: 'gender', width: 8 },
{ header: '状态', key: 'status', width: 10 },
{ header: '租赁类型', key: 'rentalCategory', width: 12 },
{ header: '月租金', key: 'monthlyRate', width: 10 },
@@ -134,7 +130,6 @@ export class RoomsController {
roomType: r.roomType || '',
capacity: r.capacity,
currentCount: r.currentCount,
gender: r.gender || '',
status: statusMap[r.status] || r.status,
rentalCategory: r.rentalCategory === 'long' ? '长租' : '短租',
monthlyRate: r.monthlyRate ?? '',
@@ -339,7 +334,6 @@ export class RoomsController {
roomType?: string;
rentalCategory?: string;
monthlyRate?: number;
gender?: '男' | '女';
}[] = [];
ws.eachRow((row, idx) => {
if (idx === 1) return;
@@ -352,13 +346,6 @@ export class RoomsController {
: undefined;
const monthlyRateRaw = Number(row.getCell(7).value);
const monthlyRate = isNaN(monthlyRateRaw) ? undefined : monthlyRateRaw;
const genderRaw = String(row.getCell(8).value || '').trim();
const gender =
genderRaw === '男' || genderRaw === '男生'
? '男'
: genderRaw === '女' || genderRaw === '女生'
? '女'
: undefined;
rows.push({
roomNumber: String(row.getCell(1).value || ''),
building: String(row.getCell(2).value || '') || undefined,
@@ -367,7 +354,6 @@ export class RoomsController {
roomType: String(row.getCell(5).value || '').trim() || undefined,
rentalCategory,
monthlyRate,
gender,
});
});
const result = await this.service.batchImport(rows);