ezcaldev
3 min readMar 22, 2021

--

Are you looking for a back end calendar system for your next project? I suggest giving EZCalDev a try. It’s a graphQL service that handles all the CRUD work for calendars, and events.

You can register at www.ezcaldev.com and head over the graphQL sandbox from the profile page to check things out.

First thing you will want to do is create a calendar. Conceptually, EzCalDev calendars are owned by you, the EzCalDev user. So let’s create a calendar for team events.

createOrUpdateCalendar mutation:

mutation {
createOrUpdateCalendar(calendarId:"team-calendar") {
id
}
}

Returns:

{
"data": {
"createOrUpdateCalendar": {
"id": "team-calendar"
}
}
}

And our first event using the createOrUpdateEvent Mutation:

mutation {
createOrUpdateEvent(
calendarId: "team-calendar"
startAt: "2021-12-19T22:40:06Z"
endAt: "2021-12-20T22:40:06Z"
title: "team kickoff event"
body: "our team is awesome!"
) {
id
}
}

Results in:

{
"data": {
"createOrUpdateEvent": {
"id": "82017e1e-ca39-49af-8cbe-fd49a1ffc0ae"
}
}
}

So now you have created an event linked to the team calendar. You can do the following to query it:

query{
Calendar(id:"team-calendar") {
id
events {
id
title
body
calendar {
id
}
}
}
}

results:

{
"data": {
"Calendar": [
{
"id": "team-calendar",
"events": [
{
"id": "82017e1e-ca39-49af-8cbe-fd49a1ffc0ae",
"title": "team kickoff event",
"body": "our team is awesome!",
"calendar": {
"id": "team-calendar"
}
}
]
}
]
}
}

To add this event to other calendars, you want to invite them. The inviteToEvent mutation will auto-create the calendar if it doesn’t already exist.

mutation {
inviteToEvent(
eventId: "82017e1e-ca39-49af-8cbe-fd49a1ffc0ae"
calendarIds: ["my-first-user-calendar"]
) {
id
}
}

Now let’s query the results:

query {
Event(id: "82017e1e-ca39-49af-8cbe-fd49a1ffc0ae") {
linkedCalendars {
action
timeStamp
calendarId
Calendar {
id
}
}
calendar {
id
}
}
}

Which results in:

{
"data": {
"Event": [
{
"linkedCalendars": [
{
"action": "INVITED",
"timeStamp": "2021-03-21T17:28:30.193669",
"calendarId": "my-first-user-calendar",
"Calendar": {
"id": "my-first-user-calendar"
}
}
],
"calendar": {
"id": "team-calendar"
}
}
]
}
}

So now we have two calendars created, an event for the team calendar and invitation sent to another calendar.

What if you want to see if there is an open slot available for two calendars? Let’s do that now using the checkAvailability query. Since the existing event starts Dec 19 at 22:40 UTC, we will first look for an open slot before that time.

query {
checkAvailability(
fromDate: "2021-12-19T22:40:06Z"
toDate: "2021-12-24T23:40:06Z"
durationMinutes:30
calendarIds: ["my-first-user-calendar", "my-second-user-calendar"]
) {
from {
formatted
}
to {
formatted
}
}
}

The result is five open slots:

{
"data": {
"checkAvailability": [
{
"from": {
"formatted": "2021-12-18T22:40:06Z"
},
"to": {
"formatted": "2021-12-18T23:10:06Z"
}
},
{
"from": {
"formatted": "2021-12-18T23:10:06Z"
},
"to": {
"formatted": "2021-12-18T23:40:06Z"
}
},
{
"from": {
"formatted": "2021-12-18T23:40:06Z"
},
"to": {
"formatted": "2021-12-19T00:10:06Z"
}
},
{
"from": {
"formatted": "2021-12-19T00:10:06Z"
},
"to": {
"formatted": "2021-12-19T00:40:06Z"
}
},
{
"from": {
"formatted": "2021-12-19T00:40:06Z"
},
"to": {
"formatted": "2021-12-19T01:10:06Z"
}
}
]
}
}

If we try again in the already accepted event time for my-first-user-calendar we get the expected no slots found.

query {
checkAvailability(
fromDate: "2021-12-19T22:40:06Z"
toDate: "2021-12-19T23:40:06Z"
durationMinutes:30
calendarIds: ["my-first-user-calendar", "my-second-user-calendar"]
) {
from {
formatted
}
to {
formatted
}
}
}

Results:

{
"data": {
"checkAvailability": []
}
}

Thanks for reading! And please check us out at www.ezcaldev.com.

EzCalDev Team

--

--