Skip to content

Commit

Permalink
fix(backend): await for events to be written (#1266)
Browse files Browse the repository at this point in the history
await for events to be written to database before returning in resolver
  • Loading branch information
Mogge authored Jul 2, 2024
1 parent b0005eb commit fd6c35d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions backend/src/graphql/resolvers/ContactFormResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { EVENT_CONTACTFORM_SEND } from '#src/event/Events'
@Resolver()
export class ContactFormResolver {
@Mutation(() => Boolean)
createContactForm(@Arg('contactFormData') contactFormData: ContactFormInput): boolean {
async createContactForm(
@Arg('contactFormData') contactFormData: ContactFormInput,
): Promise<boolean> {
void sendContactEmails(contactFormData)
void EVENT_CONTACTFORM_SEND(contactFormData.email)
await EVENT_CONTACTFORM_SEND(contactFormData.email)
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export class NewsletterSubscriptionResolver {
subscribeToNewsletterData.lastName,
subscribeToNewsletterData.email,
)
void EVENT_NEWSLETTER_SUBSCRIBE(subscribeToNewsletterData.email)
await EVENT_NEWSLETTER_SUBSCRIBE(subscribeToNewsletterData.email)
return result
}

@Mutation(() => Boolean)
async confirmNewsletter(@Arg('code') code: string): Promise<boolean> {
const result = await confirmNewsletter(code)
void EVENT_NEWSLETTER_CONFIRM(result ? result.email : undefined)
await EVENT_NEWSLETTER_CONFIRM(result ? result.email : undefined)
return !!result
}
}

0 comments on commit fd6c35d

Please sign in to comment.