fix: correct studentId-as-userId bugs in 3 files

- dingtalk.service.ts syncOneUser: find Student by userId before mapping,
  use Student.id (not User.id) as studentId FK
- sync.service.ts importDingTalkUsers: type coercion for studentId
  (method deleted in Task 4, minimal compile fix)
- schedule-sync.service.ts getStatus: remove broken teacher mapping
  query (teacher scheduling deprecated); hardcode mappedTeachers=0,
  totalTeachers=0
This commit is contained in:
2026-07-09 17:04:35 +08:00
parent 86f126671c
commit 73c1ea7a76
3 changed files with 11 additions and 16 deletions

View File

@@ -663,12 +663,13 @@ export class DingTalkService {
}
}
// Create mapping
// ponytail: find student by userId — method rewritten in Task 2
const student = await this.studentRepo.findOne({ where: { userId: user.id } });
if (!student) return;
mapping = this.studentDingMappingRepo.create({
dingUserId: du.userid,
studentId: user.id,
studentId: student.id,
});
await this.studentDingMappingRepo.save(mapping);
}
// ═══════════════════════════════════════════