fix(machines): guard Convex getById calls with 'skip' when missing id to avoid ArgumentValidationError; add unit test for getById metadata; fix build by loosening Prisma types in company service

This commit is contained in:
codex-bot 2025-10-22 08:47:55 -03:00
parent 5ff37195f5
commit 49173cdf69
6 changed files with 110 additions and 18 deletions

View file

@ -13,7 +13,10 @@ import { Skeleton } from "@/components/ui/skeleton"
import type { Id } from "@/convex/_generated/dataModel"
export function AdminMachineDetailsClient({ tenantId, machineId }: { tenantId: string; machineId: string }) {
const single = useQuery((api as any).machines.getById, { id: machineId as Id<"machines">, includeMetadata: true }) as
const single = useQuery(
(api as any).machines.getById,
machineId ? ({ id: machineId as Id<"machines">, includeMetadata: true } as const) : ("skip" as const)
) as
| Record<string, unknown>
| null
| undefined

View file

@ -9,7 +9,10 @@ import { useAuth } from "@/lib/auth-client"
export function MachineBreadcrumbs({ tenantId, machineId }: { tenantId: string; machineId: string }) {
const { convexUserId } = useAuth()
const item = useQuery((api as any).machines.getById, { id: machineId as Id<"machines">, includeMetadata: false }) as
const item = useQuery(
(api as any).machines.getById,
machineId ? ({ id: machineId as Id<"machines">, includeMetadata: false } as const) : ("skip" as const)
) as
| { hostname: string }
| null
| undefined