fix(sync): remove unused classStudentRepo injection, use transactional manager for class lookup
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
Student,
|
||||
Role,
|
||||
Class,
|
||||
ClassStudent,
|
||||
} from '../entities';
|
||||
import { SyncService } from './sync.service';
|
||||
import { SyncController } from './sync.controller';
|
||||
@@ -34,7 +33,6 @@ import { ScheduleSyncService } from './schedule-sync.service';
|
||||
Student,
|
||||
Role,
|
||||
Class,
|
||||
ClassStudent,
|
||||
]),
|
||||
IntegrationModule,
|
||||
AttendanceModule,
|
||||
|
||||
@@ -40,8 +40,6 @@ export class SyncService {
|
||||
private readonly roleRepo: Repository<Role>,
|
||||
@InjectRepository(ClassEntity)
|
||||
private readonly classRepo: Repository<ClassEntity>,
|
||||
@InjectRepository(ClassStudent)
|
||||
private readonly classStudentRepo: Repository<ClassStudent>,
|
||||
private readonly dingTalkService: DingTalkService,
|
||||
private readonly weComService: WeComService,
|
||||
private readonly attendanceImportService: AttendanceImportService,
|
||||
@@ -255,7 +253,7 @@ export class SyncService {
|
||||
const tc = await manager.count(ClassTeacher, { where: { classId } });
|
||||
const sc = await manager.count(ClassStudent, { where: { classId } });
|
||||
if (tc === 0 && sc === 0) {
|
||||
const cls = await this.classRepo.findOne({ where: { id: classId } });
|
||||
const cls = await manager.findOne(ClassEntity, { where: { id: classId } });
|
||||
warnings.push(`班级 "${cls?.name}" (deptId=${deptId}) 无任何师生`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user