Skip to content

Commit

Permalink
🎨 Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
VioMrqs committed Sep 23, 2024
1 parent 52a4e2d commit a108dc9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/applications/ssr/src/utils/zod/documentType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import { mediator } from 'mediateur';

import { ConsulterDocumentProjetQuery } from '@potentiel-domain/document';

import { validateDocumentSize } from './documentValidation';

/**
* This type is used for form validation schema when a document can be updated.
**/
export const document = zod
.string()
.or(zod.instanceof(Blob).refine((data) => data.size > 0))
.or(zod.instanceof(Blob).superRefine((file, ctx) => validateDocumentSize(file, ctx)))
.transform(async (documentKeyOrBlob) => {
if (typeof documentKeyOrBlob === 'string') {
const document = await mediator.send<ConsulterDocumentProjetQuery>({
Expand Down

0 comments on commit a108dc9

Please sign in to comment.