Skip to content

Commit

Permalink
fix incorrect blueprintId sent to database - change it to native db id (
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulooze authored Jun 27, 2023
1 parent 8707a92 commit ddd472f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/schema/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ddd472f

Please sign in to comment.