lint build test fixes

This commit is contained in:
dal 2025-08-14 09:55:37 -06:00
parent 55cf4ea98c
commit 0428552454
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
4 changed files with 31 additions and 39 deletions

View File

@ -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;

View File

@ -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;
}) || []

View File

@ -28,10 +28,10 @@ export const MetricDataTruncatedWarning: React.FC<MetricDataTruncatedWarningProp
});
// Race between the API call and the timeout
const response = await Promise.race([
const response = (await Promise.race([
downloadMetricFile(metricId),
timeoutPromise
]) as Awaited<ReturnType<typeof downloadMetricFile>>;
])) as Awaited<ReturnType<typeof downloadMetricFile>>;
// Simply navigate to the download URL
// The response-content-disposition header will force a download
@ -56,14 +56,12 @@ export const MetricDataTruncatedWarning: React.FC<MetricDataTruncatedWarningProp
)}>
<div className="flex flex-col space-y-1">
<Text className="font-medium">
{hasError
? 'Download failed'
: 'This request returned more than 5,000 records'}
{hasError ? 'Download failed' : 'This request returned more than 5,000 records'}
</Text>
<Text size="xs" variant={hasError ? 'danger' : 'secondary'}>
{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."}
</Text>
</div>
<Button

View File

@ -1,7 +1,6 @@
import { describe, expect, it } from 'vitest';
import { ShareIndividualSchema } from '../share';
import { AssetPermissionRoleSchema, ShareIndividualSchema } from '../share';
import {
AssetPermissionRoleSchema,
type ChatCreateHandlerRequest,
ChatCreateHandlerRequestSchema,
type ChatCreateRequest,
@ -11,7 +10,7 @@ import {
describe('AssetPermissionRoleSchema', () => {
it('should accept valid role values', () => {
const validRoles = ['viewer', 'editor', 'owner'];
const validRoles = ['owner', 'viewer', 'full_access', 'can_edit', 'can_filter', 'can_view'];
for (const role of validRoles) {
const result = AssetPermissionRoleSchema.safeParse(role);
@ -23,7 +22,7 @@ describe('AssetPermissionRoleSchema', () => {
});
it('should reject invalid role values', () => {
const invalidRoles = ['admin', 'user', 'guest', '', 'VIEWER'];
const invalidRoles = ['admin', 'user', 'guest', '', 'VIEWER', 'editor'];
for (const role of invalidRoles) {
const result = AssetPermissionRoleSchema.safeParse(role);