From ddd472fd45f6f8e5b77cfaebed148ccad0e8091d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20Porubsk=C3=BD?= Date: Tue, 27 Jun 2023 10:49:52 +0200 Subject: [PATCH] fix incorrect blueprintId sent to database - change it to native db id (#314) --- src/schema/device.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/schema/device.ts b/src/schema/device.ts index 5e577f4b..62a5d328 100644 --- a/src/schema/device.ts +++ b/src/schema/device.ts @@ -260,6 +260,7 @@ export const AddDeviceMutation = extendType({ } const labelIds = input.labelIds ? [...new Set(input.labelIds)] : null; try { + const nativeBlueprintId = input.blueprintId != null ? fromGraphId('Blueprint', input.blueprintId) : undefined; const device = await prisma.device.create({ data: { name: input.name, @@ -276,7 +277,7 @@ export const AddDeviceMutation = extendType({ mountParameters: input.mountParameters != null ? JSON.parse(input.mountParameters) : undefined, source: 'MANUAL', serviceState: input.serviceState ?? undefined, - blueprintId: input.blueprintId ?? undefined, + blueprintId: nativeBlueprintId, label: labelIds ? { createMany: { data: labelIds.map((id) => ({ labelId: fromGraphId('Label', id) })) } } : undefined,