@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
18 lines (13 loc) • 572 B
text/typescript
import { IGenericAttachments } from "../../../generic/types";
import { IMSTeamsAttachment } from "../../types";
export const transformFileUpload = ({ props }: IGenericAttachments): Array<IMSTeamsAttachment> => {
const attachments = props?.value?.staticValue || props?.value?.filesValue;
return attachments.reduce((acc, attachment) => {
const { value } = acc;
attachment.contentUrl = attachment.text;
value.push({ contentUrl: attachment.text });
return {...acc, value};
},
{type: "attachments", value: []}
);
};