calcom/cal.com

Update booking API allows you to update to starttime that's after the endtime + No notification sent on update.

Opened this issue ยท 1 comments

Found a bug? Please fill out the sections below. ๐Ÿ‘

Issue Summary

I wanted to update a booking. My assumption was that if i supplied a new starttime the api would automatically update the end time to be 30 minutes after the start time since that's what the event type's duration is set to. So I expected to update my 10-10:30 event to 11:00 to 11:30. Instead that resulted in an update with a startime at 11:00 and endtime at 10:30. I also didn't receive any event update notifications. I expect any update to be delivered to the attendee.

Steps to Reproduce

const util = require("util")
util.inspect.defaultOptions.depth = 25

// TODO: Right now you are testing using the builder flow so there is no phone call and hence no phone number
// Eventually this flow needs to be tested with the actual phone number associated with the call
async function updateAppointment(bookingId, reqeuestedAppointmentTime,) {
    const url = new URL(`https://api.cal.com/v1/bookings/${bookingId}`);
    url.searchParams.append("apiKey", process.env.CAL_API_KEY)

    const body = {
        startTime: reqeuestedAppointmentTime,
    }

    try {
        const response = await fetch(url, {
            headers: {
                "Content-Type": "application/json"
            },
            method: "PATCH",
            body: JSON.stringify(body),
        });

        if (!response.ok) {
            const error = {
                status: response.status,
                statusText: response.statusText,
                errorResponse: await response.json()
            }
            throw new Error(JSON.stringify(error, null, 2));
        }

        const data = await response.json();
        console.log(data)
    } catch (error) {
        throw error;
    }
}

updateAppointment("123345", '2024-09-30T10:00:00-07:00').then(console.log)

Actual Results

appointment

Technical details

  • Node.js 21.5.0

I'd like to work on this issue :)