копирование есть

This commit is contained in:
gorbenko.pavel
2026-08-14 14:03:38 +05:00
parent 10f70609ad
commit d052fd41b8
10 changed files with 540 additions and 10 deletions
@@ -53,6 +53,7 @@ interface IPortalEmployee {
fio: string;
email: string | null;
position: string | null;
company: string | null;
}
async function getJson<T>(client: AadHttpClient, baseUrl: string, path: string): Promise<T> {
@@ -112,11 +113,17 @@ export class PortalDictionaryClient {
if (!x.email) return;
const existing = byEmail.get(x.email);
if (!existing) {
byEmail.set(x.email, { fio: x.fio, email: x.email, position: x.position || '' });
} else if (!existing.position && x.position) {
// Один сотрудник — строка на каждый его отдел; должность могла найтись
// не в первой из них.
existing.position = x.position;
byEmail.set(x.email, {
fio: x.fio,
email: x.email,
position: x.position || '',
company: x.company || ''
});
} else {
// Один сотрудник — строка на каждый его отдел; должность и компания
// могли найтись не в первой из них.
if (!existing.position && x.position) existing.position = x.position;
if (!existing.company && x.company) existing.company = x.company;
}
});
return Array.from(byEmail.values());