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:
@@ -4,12 +4,12 @@ import { AttendanceRecord, DingAttendanceRaw, Student, Class } from '../entities
|
||||
import { AttendanceService } from './attendance.service';
|
||||
import { AttendanceController } from './attendance.controller';
|
||||
import { OperationLogsModule } from '../operation-logs/operation-logs.module';
|
||||
import { DepartmentsModule } from '../departments/departments.module';
|
||||
import { CommonModule } from '../common/common.module';
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([AttendanceRecord, DingAttendanceRaw, Student, Class]),
|
||||
OperationLogsModule,
|
||||
DepartmentsModule,
|
||||
CommonModule,
|
||||
],
|
||||
controllers: [AttendanceController],
|
||||
providers: [AttendanceService],
|
||||
|
||||
@@ -5,6 +5,9 @@ import { Repository } from 'typeorm';
|
||||
import { AttendanceService } from './attendance.service';
|
||||
import { AttendanceRecord } from '../entities/attendance-record.entity';
|
||||
import { DingAttendanceRaw } from '../entities/ding-attendance-raw.entity';
|
||||
import { Class } from '../entities/class.entity';
|
||||
import { Student } from '../entities/student.entity';
|
||||
import { CampusScope } from '../common/campus-scope';
|
||||
import { BatchCreateAttendanceDto } from './dto/attendance.dto';
|
||||
|
||||
describe('AttendanceService — batchCreate', () => {
|
||||
@@ -29,12 +32,18 @@ describe('AttendanceService — batchCreate', () => {
|
||||
};
|
||||
|
||||
const mockDingRepo = {};
|
||||
const mockClassRepo = { find: jest.fn().mockResolvedValue([]) };
|
||||
const mockStudentRepo = { find: jest.fn().mockResolvedValue([]) };
|
||||
const mockCampusScope = { getScopeDepartmentIds: jest.fn().mockResolvedValue(null), filter: jest.fn((w: any) => w) };
|
||||
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [
|
||||
AttendanceService,
|
||||
{ provide: getRepositoryToken(AttendanceRecord), useValue: mockRepo },
|
||||
{ provide: getRepositoryToken(DingAttendanceRaw), useValue: mockDingRepo },
|
||||
{ provide: getRepositoryToken(Class), useValue: mockClassRepo },
|
||||
{ provide: getRepositoryToken(Student), useValue: mockStudentRepo },
|
||||
{ provide: CampusScope, useValue: mockCampusScope },
|
||||
],
|
||||
}).compile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user