@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
16 lines (14 loc) • 605 B
text/typescript
import { IGenericFile } from "../../../../generic/types";
import { IRWCAnswerComponent } from '../../../types';
import { RWCAnswerComponent } from "../../../classes/v5";
export const transformFileUpload = ({props}: IGenericFile): IRWCAnswerComponent => {
const type = 'rwc-attachment';
const result: any = {
...props.rwc,
allowedTypes: props.allowedTypes || [],
isMulti: props.multiple ? "1" : "0",
isPrivate: props?.rwc?.isPrivate || false,
filesValidation: props?.rwc?.filesValidation || false
};
return new RWCAnswerComponent(result, type);
};