diff --git a/src/food-market.web/src/pages/OrgAuditLogPage.tsx b/src/food-market.web/src/pages/OrgAuditLogPage.tsx index 1a9f9b3..0503352 100644 --- a/src/food-market.web/src/pages/OrgAuditLogPage.tsx +++ b/src/food-market.web/src/pages/OrgAuditLogPage.tsx @@ -38,7 +38,12 @@ const ENTITY_TYPES = [ /** Журнал мутаций tenant'а — кто, что и когда менял. Read-only. * Запись делает OrgAuditInterceptor автоматически на каждом SaveChanges. */ -interface EmployeeOption { userId: string | null; fullName: string } +interface EmployeeOption { + userId: string | null + lastName: string + firstName: string + middleName: string | null +} export function OrgAuditLogPage() { const [page, setPage] = useState(1) @@ -51,12 +56,21 @@ export function OrgAuditLogPage() { // Список сотрудников для фильтра «Кто». Та же permission что и audit-log, // подгружается раз на сессию (staleTime). Кешируется в TanStack Query. + // Endpoint реальный — /api/organization/employees (не /api/employees). const employees = useQuery({ - queryKey: ['/api/employees', 'audit-log-filter'], - queryFn: async () => (await api.get<{ items: EmployeeOption[] }>('/api/employees?pageSize=200')).data, + queryKey: ['/api/organization/employees', 'audit-log-filter'], + queryFn: async () => (await api.get<{ items: EmployeeOption[] }>('/api/organization/employees?pageSize=200&status=all')).data, staleTime: 5 * 60 * 1000, }) + const employeeOptions = (employees.data?.items ?? []) + .filter((u) => !!u.userId) + .map((u) => ({ + userId: u.userId!, + fullName: [u.lastName, u.firstName, u.middleName].filter(Boolean).join(' ').trim(), + })) + .sort((a, b) => a.fullName.localeCompare(b.fullName, 'ru')) + const params = new URLSearchParams({ page: String(page), pageSize: '50' }) if (entityType) params.set('entityType', entityType) if (action) params.set('action', action) @@ -113,9 +127,9 @@ export function OrgAuditLogPage() {