feat: 增加宿舍查寝功能

This commit is contained in:
2026-07-22 10:55:48 +08:00
parent c888dce065
commit 54e283b687
19 changed files with 923 additions and 18 deletions

View File

@@ -7,6 +7,7 @@ import { RoomExpense } from '../entities/room-expense.entity';
import { RoomsService } from './rooms.service';
import { RoomsController } from './rooms.controller';
import { OperationLogsService } from '../operation-logs/operation-logs.service';
import { PERMISSION_KEY } from '../auth/decorators/permission.decorator';
// ── Controller test mocks ──────────────────────────────────────────────
@@ -90,6 +91,14 @@ describe('RoomsService — parseRoomNumber boundary conditions', () => {
});
});
describe('RoomsController — inspection permission boundary', () => {
it('requires the dedicated room:inspect permission', () => {
expect(Reflect.getMetadata(PERMISSION_KEY, RoomsController.prototype.updateInspection)).toEqual([
'room:inspect',
]);
});
});
// ── Service: batchImport boundary conditions ───────────────────────────
describe('RoomsService — batchImport boundary conditions', () => {
@@ -123,6 +132,7 @@ describe('RoomsService — batchImport boundary conditions', () => {
bedRepo,
lockerRepo,
dataSource,
{ getByRoomsAndDate: jest.fn().mockResolvedValue(new Map()) } as never,
);
return { service, roomRepo, bedRepo };
@@ -212,7 +222,11 @@ describe('RoomsController — boundary conditions', () => {
cb(dataRow, 2);
});
const controller = new RoomsController(mockRoomsService, mockLogService);
const controller = new RoomsController(
mockRoomsService,
mockLogService,
{ submit: jest.fn() } as never,
);
const file = { buffer: Buffer.from('fake') } as Express.Multer.File;
const req = { user: { id: 1, username: 'tester' } };