This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-06 14:25:14 +01:00
parent 058c3621df
commit e6d0b6544b

View File

@@ -343,21 +343,29 @@ async function handleGroup(
const { id, type, name, properties = {} } = payload; const { id, type, name, properties = {} } = payload;
const profileId = payload.profileId ?? context.deviceId; const profileId = payload.profileId ?? context.deviceId;
await Promise.all([ const promises: Promise<unknown>[] = [];
promises.push(
groupBuffer.add({ groupBuffer.add({
id, id,
projectId: context.projectId, projectId: context.projectId,
type, type,
name, name,
properties, properties,
}), })
);
if (profileId) {
promises.push(
upsertProfile({ upsertProfile({
id: profileId, id: String(profileId),
projectId: context.projectId, projectId: context.projectId,
isExternal: !!(payload.profileId ?? context.identity?.profileId), isExternal: !!(payload.profileId ?? context.identity?.profileId),
groups: [id], groups: [id],
}), })
]); );
}
await Promise.all(promises);
} }
export async function handler( export async function handler(