Merge pull request #82 from nik-lampe/refetch-contact
fix: refetch contact after awaiting triggers
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "plunk",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"private": true,
|
||||
"license": "agpl-3.0",
|
||||
"workspaces": {
|
||||
|
||||
@@ -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 },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user