Files
frontend/apps/as/src/entities/elapr/lib/approval-request-utils.ts
T

30 lines
933 B
TypeScript

import type { ElaprDocPrgrsResponseDto } from "../model/elapr-dmnd-interface";
export function hasCurrentUserPendingApprovalRequest(
list: ElaprDocPrgrsResponseDto[],
currentUserUuid: string | undefined,
): boolean {
if (!currentUserUuid) return false;
const normalizedUserUuid = currentUserUuid.toLowerCase();
return list.some(
(row) =>
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
);
}
export function findCurrentUserPendingApprovalRequest(
list?: ElaprDocPrgrsResponseDto[],
currentUserUuid?: string | undefined,
): ElaprDocPrgrsResponseDto | undefined {
if (!currentUserUuid) return undefined;
const normalizedUserUuid = currentUserUuid.toLowerCase();
return list?.find(
(row) =>
row.aprvrUuid?.toLowerCase() === normalizedUserUuid &&
row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
);
}