mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-03 12:16:04 +02:00
📈 Alias anonymous user with the user (#1517)
This commit is contained in:
parent
dc608d66e0
commit
c8b7093d89
1 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import { prisma } from "@rallly/database";
|
||||
import { posthog } from "@rallly/posthog/server";
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
export const mergeGuestsIntoUser = async (
|
||||
|
@ -6,7 +7,7 @@ export const mergeGuestsIntoUser = async (
|
|||
guestIds: string[],
|
||||
) => {
|
||||
try {
|
||||
return await prisma.$transaction(async (tx) => {
|
||||
await prisma.$transaction(async (tx) => {
|
||||
await Promise.all([
|
||||
tx.poll.updateMany({
|
||||
where: {
|
||||
|
@ -45,6 +46,7 @@ export const mergeGuestsIntoUser = async (
|
|||
}),
|
||||
]);
|
||||
});
|
||||
posthog?.alias({ distinctId: userId, alias: guestIds[0] });
|
||||
} catch (error) {
|
||||
Sentry.captureException(error);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue