feat: complete PRD verification fixes and deployment readiness

- Add CommonModule to provide/export CampusScope across business modules
- Replace DepartmentsModule imports with CommonModule in 11 modules
- Add missing Class/Tenant repository imports to StudentsModule and SchedulesModule
- Fix service specs with CampusScope, ClassRepository, StudentRepository mocks
- Move better-sqlite3 to optionalDependencies for production Docker builds
- Rewrite Dockerfiles for monorepo root build context
- Update docker-compose.yml service build contexts
This commit is contained in:
2026-07-06 01:55:35 +08:00
parent 5d102ca3c4
commit 7b298a615c
22 changed files with 109 additions and 46 deletions

View File

@@ -4,6 +4,8 @@ import { ConflictException } from '@nestjs/common';
import { Repository } from 'typeorm';
import { SchedulesService } from './schedules.service';
import { ClassSchedule } from '../entities/class-schedule.entity';
import { Class } from '../entities/class.entity';
import { CampusScope } from '../common/campus-scope';
/** Build a mock query-builder where each chain method returns `this`. */
function mockQueryBuilder<T>(results: T[] = []) {
@@ -28,6 +30,8 @@ describe('SchedulesService — checkConflict', () => {
providers: [
SchedulesService,
{ provide: getRepositoryToken(ClassSchedule), useValue: mockRepo },
{ provide: getRepositoryToken(Class), useValue: { find: jest.fn().mockResolvedValue([]) } },
{ provide: CampusScope, useValue: { getScopeDepartmentIds: jest.fn().mockResolvedValue(null), filter: jest.fn((w: any) => w) } },
],
}).compile();