Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
mdial89f committed Mar 15, 2024
1 parent cf44c68 commit 69e9f1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
const getIdByAuthorityName = (authorityName: string) => {
try {
const authorityId = Object.keys(SEATOOL_AUTHORITIES).find(
(key) => SEATOOL_AUTHORITIES[key] === authorityName
(key) => SEATOOL_AUTHORITIES[key] === authorityName,
);
return authorityId ? parseInt(authorityId, 10) : null;
} catch (error) {
Expand All @@ -17,6 +17,11 @@ const getIdByAuthorityName = (authorityName: string) => {
}
};

const getDateStringOrNullFromEpoc = (epocDate: number | null | undefined) =>
epocDate !== null && epocDate !== undefined
? new Date(epocDate).toISOString()
: null;

export const transform = (id: string) => {
return onemacSchema.transform((data) => {
if (data.seaActionType === "Extend") {
Expand All @@ -42,9 +47,9 @@ export const transform = (id: string) => {
stateStatus: "Submitted",
cmsStatus: "Requested",
seatoolStatus: SEATOOL_STATUS.PENDING,
statusDate: data.statusDate,
submissionDate: data.submissionDate,
changedDate: data.changedDate,
statusDate: getDateStringOrNullFromEpoc(data.statusDate),
submissionDate: getDateStringOrNullFromEpoc(data.submissionDate),
changedDate: getDateStringOrNullFromEpoc(data.changedDate),
// type, subtype, subject, description will soon be collected and available in data; this will need updating then.
subject: null,
description: null,
Expand Down
3 changes: 3 additions & 0 deletions src/services/data/handlers/setupIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const handler: Handler = async (_, __, callback) => {
await manageIndexResource({
index: "main",
update: {
approvedEffectiveDate: { type: "date" },
changedDate: { type: "date" },
finalDispositionDate: { type: "date" },
proposedDate: { type: "date" },
statusDate: { type: "date" },
submissionDate: { type: "date" },
},
Expand Down

0 comments on commit 69e9f1a

Please sign in to comment.