diff --git a/apps/server/src/api/v2/reports/[id]/sharing/PUT.ts b/apps/server/src/api/v2/reports/[id]/sharing/PUT.ts index 4f19f0c96..adbce0611 100644 --- a/apps/server/src/api/v2/reports/[id]/sharing/PUT.ts +++ b/apps/server/src/api/v2/reports/[id]/sharing/PUT.ts @@ -1,9 +1,6 @@ import { getUserOrganizationId, updateReport } from '@buster/database'; import type { ShareUpdateResponse, UpdateReportResponse } from '@buster/server-shared/reports'; -import { - type ShareUpdateRequest, - ShareUpdateRequestSchema, -} from '@buster/server-shared/share'; +import { type ShareUpdateRequest, ShareUpdateRequestSchema } from '@buster/server-shared/share'; import { zValidator } from '@hono/zod-validator'; import { Hono } from 'hono'; import { HTTPException } from 'hono/http-exception'; @@ -45,31 +42,27 @@ async function updateReportShareHandler( return updatedReport; } -const app = new Hono().put( - '/', - zValidator('json', ShareUpdateRequestSchema), - async (c) => { - const reportId = c.req.param('id'); - const request = c.req.valid('json'); - const user = c.get('busterUser'); +const app = new Hono().put('/', zValidator('json', ShareUpdateRequestSchema), async (c) => { + const reportId = c.req.param('id'); + const request = c.req.valid('json'); + const user = c.get('busterUser'); - if (!reportId) { - throw new HTTPException(404, { message: 'Report not found' }); - } - - const userOrg = await getUserOrganizationId(user.id); - - if (!userOrg) { - throw new HTTPException(403, { message: 'User is not associated with an organization' }); - } - - const updatedReport: ShareUpdateResponse = await updateReportShareHandler(reportId, request, { - id: user.id, - organizationId: userOrg.organizationId, - }); - - return c.json(updatedReport); + if (!reportId) { + throw new HTTPException(404, { message: 'Report not found' }); } -); + + const userOrg = await getUserOrganizationId(user.id); + + if (!userOrg) { + throw new HTTPException(403, { message: 'User is not associated with an organization' }); + } + + const updatedReport: ShareUpdateResponse = await updateReportShareHandler(reportId, request, { + id: user.id, + organizationId: userOrg.organizationId, + }); + + return c.json(updatedReport); +}); export default app; diff --git a/apps/web/src/api/buster_rest/collections/queryRequests.ts b/apps/web/src/api/buster_rest/collections/queryRequests.ts index 2b972a7ca..c4d1d197f 100644 --- a/apps/web/src/api/buster_rest/collections/queryRequests.ts +++ b/apps/web/src/api/buster_rest/collections/queryRequests.ts @@ -234,7 +234,9 @@ export const useUpdateCollectionShare = () => { return create(previousData, (draft) => { draft.individual_permissions = ( draft.individual_permissions?.map((t) => { - const found = params.users?.find((v: { email: string; role: string }) => v.email === t.email); + const found = params.users?.find( + (v: { email: string; role: string }) => v.email === t.email + ); if (found) return { ...t, ...found }; return t; }) || [] diff --git a/apps/web/src/controllers/MetricController/MetricViewChart/MetricDataTruncatedWarning.tsx b/apps/web/src/controllers/MetricController/MetricViewChart/MetricDataTruncatedWarning.tsx index d94831d0c..c522d316b 100644 --- a/apps/web/src/controllers/MetricController/MetricViewChart/MetricDataTruncatedWarning.tsx +++ b/apps/web/src/controllers/MetricController/MetricViewChart/MetricDataTruncatedWarning.tsx @@ -28,10 +28,10 @@ export const MetricDataTruncatedWarning: React.FC>; + ])) as Awaited>; // Simply navigate to the download URL // The response-content-disposition header will force a download @@ -56,14 +56,12 @@ export const MetricDataTruncatedWarning: React.FC
- {hasError - ? 'Download failed' - : 'This request returned more than 5,000 records'} + {hasError ? 'Download failed' : 'This request returned more than 5,000 records'} {hasError ? 'The download took too long or encountered an error. Please try again.' - : 'To see all records, you\'ll need to download the results.'} + : "To see all records, you'll need to download the results."}