improve(buffer): don't add profile if its from an event and already created

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-02-24 22:55:30 +01:00
parent bc3b9ae7bf
commit 5863dd8c2b
3 changed files with 33 additions and 22 deletions

View File

@@ -212,27 +212,33 @@ export async function createProfileAlias({
});
}
export async function upsertProfile({
id,
firstName,
lastName,
email,
avatar,
properties,
projectId,
isExternal,
}: IServiceUpsertProfile) {
return profileBuffer.add({
export async function upsertProfile(
{
id,
first_name: firstName!,
last_name: lastName!,
email: email!,
avatar: avatar!,
properties: properties as Record<string, string | undefined>,
project_id: projectId,
created_at: formatClickhouseDate(new Date()),
is_external: isExternal,
});
firstName,
lastName,
email,
avatar,
properties,
projectId,
isExternal,
}: IServiceUpsertProfile,
isFromEvent = false,
) {
return profileBuffer.add(
{
id,
first_name: firstName!,
last_name: lastName!,
email: email!,
avatar: avatar!,
properties: properties as Record<string, string | undefined>,
project_id: projectId,
created_at: formatClickhouseDate(new Date()),
is_external: isExternal,
},
isFromEvent,
);
}
export async function getProfileId({