Merge pull request #82 from nik-lampe/refetch-contact

fix: refetch contact after awaiting triggers
This commit is contained in:
Dries Augustyns
2024-09-10 11:34:25 +02:00
committed by GitHub
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "plunk",
"version": "1.0.4",
"version": "1.0.5",
"private": true,
"license": "agpl-3.0",
"workspaces": {
+4 -4
View File
@@ -103,13 +103,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact");
}
await prisma.contact.update({
contact = await prisma.contact.update({
where: { id: contact.id },
data: { subscribed: false },
});
@@ -154,13 +154,13 @@ export class Contacts {
const { id, email } = ContactSchemas.manage.parse(req.body);
const contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
let contact = id ? await ContactService.id(id) : await ContactService.email(project.id, email as string);
if (!contact || contact.projectId !== project.id) {
throw new NotFound("contact");
}
await prisma.contact.update({
contact = await prisma.contact.update({
where: { id: contact.id },
data: { subscribed: true },
});