diff --git a/package.json b/package.json index c539f871..d3bc611c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plunk", - "version": "1.0.4", + "version": "1.0.5", "private": true, "license": "agpl-3.0", "workspaces": { diff --git a/packages/api/src/controllers/v1/Contacts.ts b/packages/api/src/controllers/v1/Contacts.ts index 76a124a2..7389975a 100644 --- a/packages/api/src/controllers/v1/Contacts.ts +++ b/packages/api/src/controllers/v1/Contacts.ts @@ -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 }, });