fix: F12 P2 follow-up — batch imports set departmentId, optimize getDescendantIds, enforce campus root invariant
This commit is contained in:
@@ -284,7 +284,8 @@ export class StudentsController {
|
||||
}
|
||||
}
|
||||
}
|
||||
const result = await this.service.batchImport(rows);
|
||||
const departmentId = req.headers?.['x-campus-id'] ? parseInt(String(req.headers['x-campus-id']), 10) || undefined : undefined;
|
||||
const result = await this.service.batchImport(rows, departmentId);
|
||||
await this.logService.log({
|
||||
userId: req.user?.id,
|
||||
username: req.user?.username,
|
||||
|
||||
@@ -115,6 +115,7 @@ export class StudentsService {
|
||||
supervisor?: string;
|
||||
tenantId?: number;
|
||||
}[],
|
||||
departmentId?: number,
|
||||
) {
|
||||
let imported = 0;
|
||||
let skipped = 0;
|
||||
@@ -140,6 +141,7 @@ export class StudentsService {
|
||||
organization: row.organization || undefined,
|
||||
supervisor: row.supervisor || undefined,
|
||||
tenantId: row.tenantId || undefined,
|
||||
departmentId: departmentId ?? undefined,
|
||||
}),
|
||||
);
|
||||
imported++;
|
||||
|
||||
Reference in New Issue
Block a user