From bbcaec1cb6171716c9aace3f058e82cc9a26a4b3 Mon Sep 17 00:00:00 2001 From: Pascal Delange Date: Mon, 18 Dec 2023 17:44:44 +0100 Subject: [PATCH] PR suggestions --- .vscode/settings.json | 2 +- .../src/routes/ressources/cases/upload-file.tsx | 13 ++++++++----- packages/marble-api/scripts/openapi.yaml | 7 ------- packages/marble-api/src/generated/marble-api.ts | 2 -- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ed9021bbd..e693f6791 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,7 +5,7 @@ "i18n-ally.namespace": true, "editor.codeActionsOnSave": { - "source.fixAll": true + "source.fixAll": "explicit" }, "editor.formatOnSave": true, diff --git a/packages/app-builder/src/routes/ressources/cases/upload-file.tsx b/packages/app-builder/src/routes/ressources/cases/upload-file.tsx index 0b405ad86..6355a8e3d 100644 --- a/packages/app-builder/src/routes/ressources/cases/upload-file.tsx +++ b/packages/app-builder/src/routes/ressources/cases/upload-file.tsx @@ -4,6 +4,7 @@ import { type CaseDetail } from '@app-builder/models/cases'; import { useBackendInfo } from '@app-builder/services/auth/auth.client'; import { clientServices } from '@app-builder/services/init.client'; import { useNavigation, useRevalidator } from '@remix-run/react'; +import * as Sentry from '@sentry/remix'; import clsx from 'clsx'; import { type Namespace } from 'i18next'; import { useEffect, useState } from 'react'; @@ -14,10 +15,10 @@ import { Button, Modal } from 'ui-design-system'; import { Attachment, Plus } from 'ui-icons'; export const handle = { - i18n: ['common', 'navigation', 'cases', ...casesI18n] satisfies Namespace, + i18n: ['common', 'navigation', ...casesI18n] satisfies Namespace, }; -const MAX_FILE_SIZE_MB = 20; +const MAX_FILE_SIZE_MB = 1; const MAX_FILE_SIZE = MAX_FILE_SIZE_MB * 1024 * 1024; export function UploadFile({ caseDetail }: { caseDetail: CaseDetail }) { @@ -84,9 +85,10 @@ function UploadFileContent({ const onDrop = async (acceptedFiles: File[]) => { if (acceptedFiles.length < 1) { - toastError( - `Please select a file of an accepted type and of size less than ${MAX_FILE_SIZE_MB} MB`, - ); + toast.error('Please select a file'); + // toastError( + // `Please select a file of an accepted type and of size less than ${MAX_FILE_SIZE_MB} MB`, + // ); return; } const file = acceptedFiles[0]; @@ -106,6 +108,7 @@ function UploadFileContent({ }, ); if (!response.ok) { + Sentry.captureException(response.text()); console.error(response); toastError('An error occurred while trying to upload the file.'); return; diff --git a/packages/marble-api/scripts/openapi.yaml b/packages/marble-api/scripts/openapi.yaml index 19a01874e..3590ad2ad 100644 --- a/packages/marble-api/scripts/openapi.yaml +++ b/packages/marble-api/scripts/openapi.yaml @@ -3166,15 +3166,8 @@ components: - $ref: '#/components/schemas/CaseEventDto' - type: object required: - - resource_type - - resource_id - additional_note properties: - resource_type: - type: string - resource_id: - type: string - format: uuid additional_note: type: string UpdateCaseBody: diff --git a/packages/marble-api/src/generated/marble-api.ts b/packages/marble-api/src/generated/marble-api.ts index c10376fd4..e00cbb162 100644 --- a/packages/marble-api/src/generated/marble-api.ts +++ b/packages/marble-api/src/generated/marble-api.ts @@ -136,8 +136,6 @@ export type CaseTagsUpdatedEventDto = { export type FileAddedEvent = { event_type: "file_added"; } & CaseEventDtoBase & { - resource_type: string; - resource_id: string; additional_note: string; }; export type CaseEventDto = CaseCreatedEvent | CaseStatusUpdatedEvent | DecisionAddedEvent | CommentAddedEvent | NameUpdatedEvent | CaseTagsUpdatedEventDto | FileAddedEvent;