Skip to content

Commit

Permalink
fixed the FE to include admin changes, checked if attachments exsist
Browse files Browse the repository at this point in the history
  • Loading branch information
andieswift committed Jan 16, 2025
1 parent eae36ad commit 3181694
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/lambda/submit/submitNOSO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { ItemResult } from "shared-types/opensearch/main";
// create admin schemas
export const submitNOSOAdminSchema = z
.object({
id: z.string(),
packageId: z.string(),
adminChangeType: z.literal("NOSO"),
})
.and(z.record(z.string(), z.any()));

export const transformSubmitValuesSchema = submitNOSOAdminSchema.transform((data) => ({
...data,
event: "NOSO",
packageId: data.id,
packageId: data.packageId,
timestamp: Date.now(),
}));

Expand Down Expand Up @@ -83,6 +83,8 @@ const copyAttachments = async ({
console.log(" change log: ", attachPackageChangelog.hits.hits[0]._source);

const attachments = attachPackageChangelog.hits.hits.reduce((prev, current) => {
// check that attachments exsists
if (!current._source.attachments) return [...prev];
return [...prev, ...current._source.attachments];
}, []);

Expand Down
3 changes: 2 additions & 1 deletion lib/packages/shared-types/opensearch/changelog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export type Document = Omit<AppkDocument, "event"> &
| "withdraw-rai"
| "update-values"
| "update-id"
| "delete";
| "delete"
| "NOSO";
};

export type Response = Res<Document>;
Expand Down
6 changes: 5 additions & 1 deletion react-app/src/features/package/admin-changes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ export const AdminChange: FC<opensearch.changelog.Document> = (props) => {
}
return ["Disable formal RAI response withdraw", AC_WithdrawDisabled];
}
case "delete":
case "update-values":
case "update-id":
case "NOSO":
case "legacy-admin-change":
return [props.changeType || "Manual Update", AC_LegacyAdminChange];
default:
return [BLANK_VALUE, AC_Update];
}
}, [props.actionType, props.changeType]);
}, [props.changeType, props.event, props.raiWithdrawEnabled]);

return (
<AccordionItem key={props.id} value={props.id}>
Expand Down

0 comments on commit 3181694

Please sign in to comment.