2
0

🐛 (limits) Fix storage limit trigger and e2e tests

This commit is contained in:
Baptiste Arnaud
2022-09-24 08:58:23 +02:00
committed by Baptiste Arnaud
parent 1e26703ad4
commit 30dff2d5d7
52 changed files with 1024 additions and 2205 deletions

View File

@ -38,6 +38,17 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
userId: existingUser.id,
},
})
if (env('E2E_TEST') !== 'true')
await sendEmailNotification({
to: data.email,
subject: "You've been invited to collaborate 🤝",
html: workspaceMemberInvitationEmail({
workspaceName: workspace.name,
guestEmail: data.email,
url: `${process.env.NEXTAUTH_URL}/typebots?workspaceId=${workspace.id}`,
hostEmail: user.email ?? '',
}),
})
return res.send({
member: {
userId: existingUser.id,
@ -47,19 +58,21 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
workspaceId: data.workspaceId,
},
})
} else await prisma.workspaceInvitation.create({ data })
if (env('E2E_TEST') !== 'true')
await sendEmailNotification({
to: data.email,
subject: "You've been invited to collaborate 🤝",
html: workspaceMemberInvitationEmail({
workspaceName: workspace.name,
guestEmail: data.email,
url: `${process.env.NEXTAUTH_URL}/typebots?workspaceId=${workspace.id}`,
hostEmail: user.email ?? '',
}),
})
return res.send({ message: 'success' })
} else {
const invitation = await prisma.workspaceInvitation.create({ data })
if (env('E2E_TEST') !== 'true')
await sendEmailNotification({
to: data.email,
subject: "You've been invited to collaborate 🤝",
html: workspaceMemberInvitationEmail({
workspaceName: workspace.name,
guestEmail: data.email,
url: `${process.env.NEXTAUTH_URL}/typebots?workspaceId=${workspace.id}`,
hostEmail: user.email ?? '',
}),
})
return res.send({ invitation })
}
}
methodNotAllowed(res)
}