From 8bea0e8401cea5d423ddc61d0d86616ced950be0 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 13:38:45 +0000 Subject: [PATCH] Fix Biome linting error: wrap switch default case in block scope - Add curly braces around default case content to satisfy noSwitchDeclarations rule - Prevents variable declarations from being accessible to other switch cases - Apply Biome formatting fixes for import statement and spacing Co-Authored-By: nate@buster.so --- apps/server/src/api/v2/title/GET.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/server/src/api/v2/title/GET.ts b/apps/server/src/api/v2/title/GET.ts index 395eac76e..c5fb7579a 100644 --- a/apps/server/src/api/v2/title/GET.ts +++ b/apps/server/src/api/v2/title/GET.ts @@ -1,4 +1,10 @@ -import { getChatTitle, getCollectionTitle, getDashboardTitle, getMetricTitle, getUserOrganizationId } from '@buster/database'; +import { + getChatTitle, + getCollectionTitle, + getDashboardTitle, + getMetricTitle, + getUserOrganizationId, +} from '@buster/database'; import { GetTitleRequestSchema, type GetTitleResponse } from '@buster/server-shared/title'; import { zValidator } from '@hono/zod-validator'; import { Hono } from 'hono'; @@ -12,14 +18,14 @@ const app = new Hono() try { const { assetId, assetType } = c.req.valid('query'); const user = c.get('busterUser'); - + const userOrg = await getUserOrganizationId(user.id); if (!userOrg) { throw new HTTPException(403, { message: 'User is not associated with an organization' }); } - + let title: string | null = null; - + switch (assetType) { case 'chat': title = await getChatTitle({ assetId, organizationId: userOrg.organizationId }); @@ -33,15 +39,16 @@ const app = new Hono() case 'dashboard': title = await getDashboardTitle({ assetId, organizationId: userOrg.organizationId }); break; - default: + default: { const _exhaustive: never = assetType; throw new HTTPException(400, { message: `Unsupported asset type: ${assetType}` }); + } } - + if (title === null) { throw new HTTPException(404, { message: 'Asset not found or access denied' }); } - + const response: GetTitleResponse = { title }; return c.json(response); } catch (error) {