Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions clients/javascript/lib/eventClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,6 @@ export class NitteiEventClient extends NitteiBaseClient {
}
}

/**
* Update an event (V2)
* @param eventId - id of the event
* @param data - data of the event
* @returns - the updated event
*/
public async updateV2(
eventId: ID,
data: UpdateEventRequestBody
): Promise<CalendarEventResponse> {
const res = await this.patch<CalendarEventResponse>(
`/user/events_v2/${eventId}`,
data
)

return {
event: convertEventDates(res.event),
}
}

/**
* Create a new calendar event
* @param userId - id of the user
Expand Down
30 changes: 15 additions & 15 deletions clients/javascript/tests/calendarEvent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ describe('CalendarEvent API', () => {
expect(res2.event.updated).toEqual(new Date(0))
})

it('should be able to update event with v2 endpoint (PATCH behavior)', async () => {
it('should be able to update event with PATCH behavior', async () => {
const res = await adminClient.events.create(userId, {
calendarId,
duration: 1000,
Expand All @@ -417,7 +417,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Test partial update - only update title and duration
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
title: 'updated title',
duration: 2000,
})
Expand All @@ -438,7 +438,7 @@ describe('CalendarEvent API', () => {
expect(res2.event.busy).toBe(true)
})

it('should be able to set optional fields to NULL with v2 endpoint', async () => {
it('should be able to set optional fields to NULL', async () => {
const res = await adminClient.events.create(userId, {
calendarId,
duration: 1000,
Expand All @@ -455,7 +455,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Test setting optional fields to NULL
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
title: null,
description: null,
eventType: null,
Expand Down Expand Up @@ -483,7 +483,7 @@ describe('CalendarEvent API', () => {
expect(res2.event.busy).toBe(true)
})

it('should be able to update exdates and reminders with v2 endpoint', async () => {
it('should be able to update exdates and reminders', async () => {
const res = await adminClient.events.create(userId, {
calendarId,
duration: 1000,
Expand All @@ -494,7 +494,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Test updating exdates and reminders
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
exdates: [new Date(3000), new Date(4000)],
reminders: [{ delta: 30, identifier: 'reminder-2' }],
})
Expand All @@ -505,7 +505,7 @@ describe('CalendarEvent API', () => {
])

// Test setting to empty arrays
const res3 = await adminClient.events.updateV2(eventId, {
const res3 = await adminClient.events.update(eventId, {
exdates: [],
reminders: [],
})
Expand All @@ -514,7 +514,7 @@ describe('CalendarEvent API', () => {
expect(res3.event.reminders).toEqual([])
})

it('should handle recurrence updates with v2 endpoint', async () => {
it('should handle recurrence updates', async () => {
const res = await adminClient.events.create(userId, {
calendarId,
duration: 1000,
Expand All @@ -528,7 +528,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Test updating recurrence
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
recurrence: {
freq: 'weekly',
interval: 2,
Expand All @@ -545,14 +545,14 @@ describe('CalendarEvent API', () => {
)

// Test setting recurrence to NULL
const res3 = await adminClient.events.updateV2(eventId, {
const res3 = await adminClient.events.update(eventId, {
recurrence: null,
})

expect(res3.event.recurrence).toBeNull()
})

it('should handle recurring event fields with v2 endpoint', async () => {
it('should handle recurring event fields', async () => {
const recurringEventId = crypto.randomUUID()
const recurringEventId2 = crypto.randomUUID()

Expand All @@ -566,7 +566,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Test updating recurring event fields
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
recurringEventId: recurringEventId2,
originalStartTime: new Date(600),
})
Expand All @@ -575,7 +575,7 @@ describe('CalendarEvent API', () => {
expect(res2.event.originalStartTime).toEqual(new Date(600))

// Test setting to NULL
const res3 = await adminClient.events.updateV2(eventId, {
const res3 = await adminClient.events.update(eventId, {
recurringEventId: null,
originalStartTime: null,
})
Expand All @@ -584,7 +584,7 @@ describe('CalendarEvent API', () => {
expect(res3.event.originalStartTime).toBeNull()
})

it('should preserve existing values when fields are not provided in v2 update', async () => {
it('should preserve existing values when fields are not provided in update', async () => {
const recurringEventId = crypto.randomUUID()
const res = await adminClient.events.create(userId, {
calendarId,
Expand Down Expand Up @@ -613,7 +613,7 @@ describe('CalendarEvent API', () => {
const eventId = res.event.id

// Update only one field
const res2 = await adminClient.events.updateV2(eventId, {
const res2 = await adminClient.events.update(eventId, {
title: 'only title updated',
})

Expand Down
7 changes: 0 additions & 7 deletions crates/api/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ pub fn configure_routes() -> OpenApiRouter {
auth::account_can_modify_event_middleware,
)),
)
.route(
"/user/events_v2/{event_id}",
patch(update_event_admin_controller).layer(axum::middleware::from_fn(
auth::account_can_modify_event_middleware,
)),
)
// Delete an event by uid (admin route)
.route(
"/user/events/{event_id}",
Expand Down Expand Up @@ -110,7 +104,6 @@ pub fn configure_routes() -> OpenApiRouter {
.route("/events/{event_id}", get(get_event_controller))
// Update an event by uid
.route("/events/{event_id}", patch(update_event_controller))
.route("/events_v2/{event_id}", patch(update_event_controller))
// Delete an event by uid
.route("/events/{event_id}", delete(delete_event_controller))
// Get event instances
Expand Down