Building a Calendar Scheduling App Backend with Hasura Scheduled Triggers
In this post, we discuss how to build a calendar app backend with scheduling logic using Hasura GraphQL and its Scheduled Triggers API. The core functionalities of the app follow an event-driven programming paradigm, involving scheduling one-time and recurring events, inviting users to events, and checking user availability. The main challenge is confirming event scheduling based on availability, sending email reminders/notifications before events begin, and handling changes like modified timestamps. The app's database schema consists of three tables: user, event, and event_attendee. For recurrence patterns, the iCal RFC format is followed. Hasura GraphQL auto-generates CRUD APIs for the app, allowing declarative authorization rules and scheduling events in the future. Data fetching queries required for a calendar app include fetching all events of a user for a given day/week/month/year. Business logic includes validating event scheduling based on availability, sending invitation emails upon event confirmation, and scheduling email or notification reminders before events begin. Scheduled Triggers in Hasura are used to schedule events at specific times. The app uses one-off scheduled events for this purpose. Custom mutations are created using Actions, which allow writing custom business logic without setting up a GraphQL server from scratch. Validations include checking event start and end dates and user availability during the event timeframe. The webhook URL specified during the creation of a scheduled event handles cancellation logic and sends email notifications as part of the app's functionality. Permission rules are configured declaratively, allowing for flexible role-based access control.
Company
Hasura
Date published
Aug. 10, 2020
Author(s)
Praveen Durairaju
Word count
1570
Hacker News points
None found.
Language
English