Skip to content

Commit

Permalink
transform file object during validation as a placeholder for future a…
Browse files Browse the repository at this point in the history
…sync work
  • Loading branch information
ethangardner committed Nov 20, 2024
1 parent 0c4796b commit d22113d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/forms/src/patterns/attachment/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ const createSchema = (data: AttachmentPattern['data']) => {
{
message: `The maximum allowable size per file is ${data.maxFileSizeMB}MB`,
}
);
)
.transform((items: File[]) => {
/**
* TODO: during the form filler epic, we'll want to switch this and other validation
* methods to be async for consistency and talk about how we're returning the object on the session.
* The tentative plan is to write the file to storage and return the ID on the session here.
*/
return items.map(item => {
return {
name: item.name,
data: 'YWJj', // Just some dummy base64 encoded data => "abc"
};
});
});
};

export const parseUserInput: ParseUserInput<
Expand Down

0 comments on commit d22113d

Please sign in to comment.