diff --git a/apps/server/src/api/v2/reports/[id]/GET.ts b/apps/server/src/api/v2/reports/[id]/GET.ts index 03affef58..66a780283 100644 --- a/apps/server/src/api/v2/reports/[id]/GET.ts +++ b/apps/server/src/api/v2/reports/[id]/GET.ts @@ -2,6 +2,7 @@ import { getReport } from '@buster/database'; import type { GetReportIndividualResponse } from '@buster/server-shared/reports'; import { Hono } from 'hono'; import { HTTPException } from 'hono/http-exception'; +import { standardErrorHandler } from '../../../../utils/response'; export async function getReportHandler( reportId: string, @@ -14,16 +15,18 @@ export async function getReportHandler( return response; } -const app = new Hono().get('/', async (c) => { - const reportId = c.req.param('id'); - const user = c.get('busterUser'); +const app = new Hono() + .get('/', async (c) => { + const reportId = c.req.param('id'); + const user = c.get('busterUser'); - if (!reportId) { - throw new HTTPException(404, { message: 'Report ID is required' }); - } + if (!reportId) { + throw new HTTPException(404, { message: 'Report ID is required' }); + } - const response: GetReportIndividualResponse = await getReportHandler(reportId, user); - return c.json(response); -}); + const response: GetReportIndividualResponse = await getReportHandler(reportId, user); + return c.json(response); + }) + .onError(standardErrorHandler); export default app; diff --git a/apps/server/src/api/v2/reports/index.ts b/apps/server/src/api/v2/reports/index.ts index 47aa2c169..a9160bc2b 100644 --- a/apps/server/src/api/v2/reports/index.ts +++ b/apps/server/src/api/v2/reports/index.ts @@ -1,8 +1,13 @@ import { Hono } from 'hono'; import { requireAuth } from '../../../middleware/auth'; +import { standardErrorHandler } from '../../../utils/response'; import GET from './GET'; import individualReport from './[id]'; -const app = new Hono().use('*', requireAuth).route('/', GET).route('/:id', individualReport); +const app = new Hono() + .use('*', requireAuth) + .route('/', GET) + .route('/:id', individualReport) + .onError(standardErrorHandler); export default app; diff --git a/apps/web/src/components/features/sidebars/SidebarPrimary.tsx b/apps/web/src/components/features/sidebars/SidebarPrimary.tsx index ea1cd3584..ae980f396 100644 --- a/apps/web/src/components/features/sidebars/SidebarPrimary.tsx +++ b/apps/web/src/components/features/sidebars/SidebarPrimary.tsx @@ -69,13 +69,6 @@ const yourStuff = ( label: 'Your stuff', id: 'your-stuff', items: [ - { - label: 'Reports', - icon: , - route: createBusterRoute({ route: BusterRoutes.APP_REPORTS }), - id: BusterRoutes.APP_REPORTS, - active: isActiveCheck('report', BusterRoutes.APP_REPORTS) - }, { label: 'Metrics', icon: , @@ -96,6 +89,13 @@ const yourStuff = ( route: createBusterRoute({ route: BusterRoutes.APP_COLLECTIONS }), id: BusterRoutes.APP_COLLECTIONS, active: isActiveCheck('collection', BusterRoutes.APP_COLLECTIONS) + }, + { + label: 'Reports', + icon: , + route: createBusterRoute({ route: BusterRoutes.APP_REPORTS }), + id: BusterRoutes.APP_REPORTS, + active: isActiveCheck('report', BusterRoutes.APP_REPORTS) } ] }; diff --git a/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx b/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx index 39e3e7e43..4feff10d5 100644 --- a/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx +++ b/apps/web/src/controllers/ReportsListController/ReportItemsContainer.tsx @@ -136,7 +136,7 @@ const EmptyState: React.FC<{ return (