Управление заявками (#7)
Tests / frontend-test (push) Successful in 43s
Tests / backend-test (push) Successful in 2m36s

Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz>
Reviewed-on: http://git.tnsu.kz/gorbenko.pavel/tnsu-approval-route/pulls/7
This commit was merged in pull request #7.
This commit is contained in:
2026-08-07 09:49:38 +00:00
parent 9d9f390548
commit 0ffa032ade
42 changed files with 2436 additions and 65 deletions
@@ -1,3 +1,4 @@
/* eslint-disable @rushstack/no-new-null -- поля "сырых" IPortal*-интерфейсов 1:1 зеркалят nullable JSON-контракт портала api.tnsu.kz */
import { AadHttpClient, HttpClientResponse } from '@microsoft/sp-http';
import { Company, Department, Employee, Project } from '../models';
import { ApiClientError } from './httpClient';
@@ -51,6 +52,7 @@ export interface IProjectSearchResult {
interface IPortalEmployee {
fio: string;
email: string | null;
position: string | null;
}
async function getJson<T>(client: AadHttpClient, baseUrl: string, path: string): Promise<T> {
@@ -107,7 +109,15 @@ export class PortalDictionaryClient {
const byEmail = new Map<string, Employee>();
(raw ?? []).forEach(x => {
if (x.email && !byEmail.has(x.email)) byEmail.set(x.email, { fio: x.fio, email: x.email });
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;
}
});
return Array.from(byEmail.values());
}