Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(unidirectional-camel-case): Make seatool non-case sensitive when writing to opensearch #958

Merged
merged 9 commits into from
Jan 10, 2025
24 changes: 13 additions & 11 deletions lib/packages/shared-types/opensearch/main/transforms/seatool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ const getRaiDate = (data: SeaTool) => {
const getDateStringOrNullFromEpoc = (epocDate: number | null | undefined) =>
epocDate !== null && epocDate !== undefined ? new Date(epocDate).toISOString() : null;

const compileSrtList = (
officers: SeatoolOfficer[] | null | undefined,
): { name: string; email: string }[] =>
officers?.length
? officers.map((o) => ({
name: `${o.FIRST_NAME || ""} ${o.LAST_NAME || ""}`,
email: o.EMAIL || "",
}))
: [];
const compileSrtList = (
officers: SeatoolOfficer[] | null | undefined,
): { name: string; email: string }[] =>
officers?.length
? officers.map((o) => ({
name: `${o.FIRST_NAME || ""} ${o.LAST_NAME || ""}`,
email: o.EMAIL || "",
}))
: [];

const getFinalDispositionDate = (status: string, record: SeaTool) => {
return status && finalDispositionStatuses.includes(status)
Expand Down Expand Up @@ -124,11 +124,13 @@ export const transform = (id: string) => {
: null;

const { stateStatus, cmsStatus } = getStatus(seatoolStatus);

const resp = {
id,
id: id.toUpperCase(),
actionType: data.ACTIONTYPES?.[0].ACTION_NAME,
approvedEffectiveDate: getDateStringOrNullFromEpoc(
data.STATE_PLAN.APPROVED_EFFECTIVE_DATE || data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE,
data.STATE_PLAN.APPROVED_EFFECTIVE_DATE ||
data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE,
),
changed_date: data.STATE_PLAN.CHANGED_DATE,
description: data.STATE_PLAN.SUMMARY_MEMO,
Expand Down
Loading