mirror of https://github.com/buster-so/buster.git
Add version number search params validation to route files
Co-authored-by: natemkelley <natemkelley@gmail.com>
This commit is contained in:
parent
e33f52a8a1
commit
080dcc8cf5
|
@ -1,8 +1,22 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/chats/$chatId/dashboard/$dashboardId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/chats/$chatId/dashboard/$dashboardId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/app/chats/$chatId/metrics/$metricId')({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
report_version_number?: number
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/chats/$chatId/report/$reportId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
report_version_number: search.report_version_number
|
||||
? Number(search.report_version_number)
|
||||
: undefined,
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
report_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/app/chats/$chatId/report/$reportId')({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
report_version_number: search.report_version_number
|
||||
? Number(search.report_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/chats/$chatId/dashboards/$dashboardId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/chats/$chatId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/dashboard/$dashboardId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
dashboard_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/dashboard/$dashboardId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
dashboard_version_number: search.dashboard_version_number
|
||||
? Number(search.dashboard_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
metric_version_number?: number
|
||||
}
|
||||
|
||||
export const Route = createFileRoute(
|
||||
'/app/collections/$collectionId/metrics/$metricId',
|
||||
)({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import { createFileRoute } from '@tanstack/react-router';
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
metric_version_number?: number;
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/app/metrics/$metricId')({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
metric_version_number: search.metric_version_number
|
||||
? Number(search.metric_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import { createFileRoute } from '@tanstack/react-router';
|
||||
|
||||
// Search params interface for type safety
|
||||
interface RouteSearch {
|
||||
report_version_number?: number;
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/app/reports/$reportId')({
|
||||
validateSearch: (search: Record<string, unknown>): RouteSearch => ({
|
||||
report_version_number: search.report_version_number
|
||||
? Number(search.report_version_number)
|
||||
: undefined,
|
||||
}),
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue