Skip to content

Commit

Permalink
Merge pull request #82 from nik-lampe/refetch-contact
Browse files Browse the repository at this point in the history
fix: refetch contact after awaiting triggers
  • Loading branch information
driaug authored Sep 10, 2024
2 parents b373827 + 29590f3 commit 7202606
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plunk",
"version": "1.0.4",
"version": "1.0.5",
"private": true,
"license": "agpl-3.0",
"workspaces": {
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/controllers/v1/Contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
});
Expand Down Expand Up @@ -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 },
});
Expand Down

0 comments on commit 7202606

Please sign in to comment.