From 38e62786e4c9b0dbfbc7920c27ff56a1211e1608 Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Sun, 14 Apr 2024 01:16:37 +0300 Subject: [PATCH] chore: remove /ee from apiv2 urls (#14568) * chore: remove /ee from apiv2 urls * fixup! chore: remove /ee from apiv2 urls * chore: remove /ee from apiv2 urls * fixup! chore: remove /ee from apiv2 urls * fixup! fixup! chore: remove /ee from apiv2 urls * fixup! fixup! fixup! chore: remove /ee from apiv2 urls --- apps/api/v2/src/app.rewrites.middleware.ts | 3 + .../bookings.controller.e2e-spec.ts | 12 +- .../controllers/bookings.controller.ts | 2 +- .../controllers/calendars.controller.ts | 2 +- .../src/ee/gcal/gcal.controller.e2e-spec.ts | 18 +-- apps/api/v2/src/ee/gcal/gcal.controller.ts | 4 +- .../v2/src/ee/me/me.controller.e2e-spec.ts | 13 +-- apps/api/v2/src/ee/me/me.controller.ts | 2 +- .../v2/src/ee/provider/provider.controller.ts | 2 +- apps/api/v2/swagger/documentation.json | 107 ++++++++++++------ .../atoms/hooks/useCalendarsBusyTimes.ts | 2 +- .../atoms/hooks/useConnectedCalendars.tsx | 2 +- .../platform/atoms/hooks/useCreateBooking.ts | 2 +- .../atoms/hooks/useCreateInstantBooking.ts | 2 +- .../atoms/hooks/useCreateRecurringBooking.ts | 4 +- packages/platform/atoms/hooks/useGcal.ts | 4 +- packages/platform/constants/api.ts | 4 +- packages/platform/examples/base/README.md | 2 +- packages/platform/sdk/src/swagger-types.d.ts | 58 +++++----- 19 files changed, 139 insertions(+), 106 deletions(-) diff --git a/apps/api/v2/src/app.rewrites.middleware.ts b/apps/api/v2/src/app.rewrites.middleware.ts index d58bf352ec..67c314ec74 100644 --- a/apps/api/v2/src/app.rewrites.middleware.ts +++ b/apps/api/v2/src/app.rewrites.middleware.ts @@ -7,6 +7,9 @@ export class RewriterMiddleware implements NestMiddleware { if (req.url.startsWith("/api/v2")) { req.url = req.url.replace("/api/v2", "/v2"); } + if (req.url.startsWith("/v2/ee")) { + req.url = req.url.replace("/v2/ee", "/v2"); + } next(); } } diff --git a/apps/api/v2/src/ee/bookings/controllers/bookings.controller.e2e-spec.ts b/apps/api/v2/src/ee/bookings/controllers/bookings.controller.e2e-spec.ts index 2083867b04..6bf1c431e1 100644 --- a/apps/api/v2/src/ee/bookings/controllers/bookings.controller.e2e-spec.ts +++ b/apps/api/v2/src/ee/bookings/controllers/bookings.controller.e2e-spec.ts @@ -115,7 +115,7 @@ describe("Bookings Endpoints", () => { }; return request(app.getHttpServer()) - .post("/api/v2/ee/bookings") + .post("/v2/bookings") .send(body) .expect(201) .then(async (response) => { @@ -138,7 +138,7 @@ describe("Bookings Endpoints", () => { it("should get bookings", async () => { return request(app.getHttpServer()) - .get("/api/v2/ee/bookings?filters[status]=upcoming") + .get("/v2/bookings?filters[status]=upcoming") .then((response) => { console.log("asap responseBody", JSON.stringify(response.body, null, 2)); const responseBody: GetBookingsOutput = response.body; @@ -159,7 +159,7 @@ describe("Bookings Endpoints", () => { it("should get booking", async () => { return request(app.getHttpServer()) - .get(`/api/v2/ee/bookings/${createdBooking.uid}`) + .get(`/v2/bookings/${createdBooking.uid}`) .then((response) => { const responseBody: GetBookingOutput = response.body; const bookingInfo = responseBody.data; @@ -199,7 +199,7 @@ describe("Bookings Endpoints", () => { // }; // return request(app.getHttpServer()) - // .post("/api/v2/ee/bookings/reccuring") + // .post("/v2/bookings/reccuring") // .send(body) // .expect(201) // .then((response) => { @@ -231,7 +231,7 @@ describe("Bookings Endpoints", () => { // }; // return request(app.getHttpServer()) - // .post("/api/v2/ee/bookings/instant") + // .post("/v2/bookings/instant") // .send(body) // .expect(201) // .then((response) => { @@ -250,7 +250,7 @@ describe("Bookings Endpoints", () => { }; return request(app.getHttpServer()) - .post(`/api/v2/ee/bookings/${bookingId}/cancel`) + .post(`/v2/bookings/${bookingId}/cancel`) .send(body) .expect(201) .then((response) => { diff --git a/apps/api/v2/src/ee/bookings/controllers/bookings.controller.ts b/apps/api/v2/src/ee/bookings/controllers/bookings.controller.ts index 2962055563..039f33a767 100644 --- a/apps/api/v2/src/ee/bookings/controllers/bookings.controller.ts +++ b/apps/api/v2/src/ee/bookings/controllers/bookings.controller.ts @@ -68,7 +68,7 @@ const DEFAULT_PLATFORM_PARAMS = { }; @Controller({ - path: "ee/bookings", + path: "/bookings", version: "2", }) @UseGuards(PermissionsGuard) diff --git a/apps/api/v2/src/ee/calendars/controllers/calendars.controller.ts b/apps/api/v2/src/ee/calendars/controllers/calendars.controller.ts index 39bcf9e1ab..4a1e705672 100644 --- a/apps/api/v2/src/ee/calendars/controllers/calendars.controller.ts +++ b/apps/api/v2/src/ee/calendars/controllers/calendars.controller.ts @@ -11,7 +11,7 @@ import { SUCCESS_STATUS } from "@calcom/platform-constants"; import { CalendarBusyTimesInput } from "@calcom/platform-types"; @Controller({ - path: "ee/calendars", + path: "/calendars", version: "2", }) @UseGuards(AccessTokenGuard) diff --git a/apps/api/v2/src/ee/gcal/gcal.controller.e2e-spec.ts b/apps/api/v2/src/ee/gcal/gcal.controller.e2e-spec.ts index 08bab9f667..9ca80e34a8 100644 --- a/apps/api/v2/src/ee/gcal/gcal.controller.e2e-spec.ts +++ b/apps/api/v2/src/ee/gcal/gcal.controller.e2e-spec.ts @@ -85,14 +85,14 @@ describe("Platform Gcal Endpoints", () => { it(`/GET/ee/gcal/oauth/auth-url: it should respond 401 with invalid access token`, async () => { await request(app.getHttpServer()) - .get(`/api/v2/ee/gcal/oauth/auth-url`) + .get(`/v2/gcal/oauth/auth-url`) .set("Authorization", `Bearer invalid_access_token`) .expect(401); }); it(`/GET/ee/gcal/oauth/auth-url: it should auth-url to google oauth with valid access token `, async () => { const response = await request(app.getHttpServer()) - .get(`/api/v2/ee/gcal/oauth/auth-url`) + .get(`/v2/gcal/oauth/auth-url`) .set("Authorization", `Bearer ${accessTokenSecret}`) .set("Origin", CLIENT_REDIRECT_URI) .expect(200); @@ -103,7 +103,7 @@ describe("Platform Gcal Endpoints", () => { it(`/GET/ee/gcal/oauth/save: without oauth code`, async () => { await request(app.getHttpServer()) .get( - `/api/v2/ee/gcal/oauth/save?state=accessToken=${accessTokenSecret}&origin%3D${CLIENT_REDIRECT_URI}&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` + `/v2/gcal/oauth/save?state=accessToken=${accessTokenSecret}&origin%3D${CLIENT_REDIRECT_URI}&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` ) .expect(400); }); @@ -111,7 +111,7 @@ describe("Platform Gcal Endpoints", () => { it(`/GET/ee/gcal/oauth/save: without access token`, async () => { await request(app.getHttpServer()) .get( - `/api/v2/ee/gcal/oauth/save?state=origin%3D${CLIENT_REDIRECT_URI}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` + `/v2/gcal/oauth/save?state=origin%3D${CLIENT_REDIRECT_URI}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` ) .expect(400); }); @@ -119,25 +119,25 @@ describe("Platform Gcal Endpoints", () => { it(`/GET/ee/gcal/oauth/save: without origin`, async () => { await request(app.getHttpServer()) .get( - `/api/v2/ee/gcal/oauth/save?state=accessToken=${accessTokenSecret}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` + `/v2/gcal/oauth/save?state=accessToken=${accessTokenSecret}&code=4/0AfJohXmBuT7QVrEPlAJLBu4ZcSnyj5jtDoJqSW_riPUhPXQ70RPGkOEbVO3xs-OzQwpPQw&scope=https://www.googleapis.com/auth/calendar.readonly%20https://www.googleapis.com/auth/calendar.events` ) .expect(400); }); it(`/GET/ee/gcal/check with access token but without origin`, async () => { await request(app.getHttpServer()) - .get(`/api/v2/ee/gcal/check`) + .get(`/v2/gcal/check`) .set("Authorization", `Bearer ${accessTokenSecret}`) .expect(400); }); it(`/GET/ee/gcal/check without access token`, async () => { - await request(app.getHttpServer()).get(`/api/v2/ee/gcal/check`).expect(401); + await request(app.getHttpServer()).get(`/v2/gcal/check`).expect(401); }); it(`/GET/ee/gcal/check with access token and origin but no credentials`, async () => { await request(app.getHttpServer()) - .get(`/api/v2/ee/gcal/check`) + .get(`/v2/gcal/check`) .set("Authorization", `Bearer ${accessTokenSecret}`) .set("Origin", CLIENT_REDIRECT_URI) .expect(400); @@ -151,7 +151,7 @@ describe("Platform Gcal Endpoints", () => { "google-calendar" ); await request(app.getHttpServer()) - .get(`/api/v2/ee/gcal/check`) + .get(`/v2/gcal/check`) .set("Authorization", `Bearer ${accessTokenSecret}`) .set("Origin", CLIENT_REDIRECT_URI) .expect(200); diff --git a/apps/api/v2/src/ee/gcal/gcal.controller.ts b/apps/api/v2/src/ee/gcal/gcal.controller.ts index 22d3e5d8f1..962133d08f 100644 --- a/apps/api/v2/src/ee/gcal/gcal.controller.ts +++ b/apps/api/v2/src/ee/gcal/gcal.controller.ts @@ -44,7 +44,7 @@ const CALENDAR_SCOPES = [ // Controller for the GCalConnect Atom @Controller({ - path: "ee/gcal", + path: "/gcal", version: "2", }) @DocsTags("Google Calendar") @@ -60,7 +60,7 @@ export class GcalController { private readonly calendarsService: CalendarsService ) {} - private redirectUri = `${this.config.get("api.url")}/ee/gcal/oauth/save`; + private redirectUri = `${this.config.get("api.url")}/gcal/oauth/save`; @Get("/oauth/auth-url") @HttpCode(HttpStatus.OK) diff --git a/apps/api/v2/src/ee/me/me.controller.e2e-spec.ts b/apps/api/v2/src/ee/me/me.controller.e2e-spec.ts index 7c48064816..d5179acd75 100644 --- a/apps/api/v2/src/ee/me/me.controller.e2e-spec.ts +++ b/apps/api/v2/src/ee/me/me.controller.e2e-spec.ts @@ -71,7 +71,7 @@ describe("Me Endpoints", () => { it("should get user associated with access token", async () => { return request(app.getHttpServer()) - .get("/api/v2/ee/me") + .get("/v2/me") .expect(200) .then((response) => { const responseBody: ApiSuccessResponse = response.body; @@ -90,7 +90,7 @@ describe("Me Endpoints", () => { const body: UpdateManagedUserInput = { timeZone: "Europe/Rome" }; return request(app.getHttpServer()) - .patch("/api/v2/ee/me") + .patch("/v2/me") .send(body) .expect(200) .then(async (response) => { @@ -114,22 +114,19 @@ describe("Me Endpoints", () => { it("should not update user associated with access token given invalid timezone", async () => { const bodyWithIncorrectTimeZone: UpdateManagedUserInput = { timeZone: "Narnia/Woods" }; - return request(app.getHttpServer()).patch("/api/v2/ee/me").send(bodyWithIncorrectTimeZone).expect(400); + return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectTimeZone).expect(400); }); it("should not update user associated with access token given invalid time format", async () => { const bodyWithIncorrectTimeFormat: UpdateManagedUserInput = { timeFormat: 100 }; - return request(app.getHttpServer()) - .patch("/api/v2/ee/me") - .send(bodyWithIncorrectTimeFormat) - .expect(400); + return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectTimeFormat).expect(400); }); it("should not update user associated with access token given invalid week start", async () => { const bodyWithIncorrectWeekStart: UpdateManagedUserInput = { weekStart: "waba luba dub dub" }; - return request(app.getHttpServer()).patch("/api/v2/ee/me").send(bodyWithIncorrectWeekStart).expect(400); + return request(app.getHttpServer()).patch("/v2/me").send(bodyWithIncorrectWeekStart).expect(400); }); afterAll(async () => { diff --git a/apps/api/v2/src/ee/me/me.controller.ts b/apps/api/v2/src/ee/me/me.controller.ts index c32d59906f..2c64df0397 100644 --- a/apps/api/v2/src/ee/me/me.controller.ts +++ b/apps/api/v2/src/ee/me/me.controller.ts @@ -14,7 +14,7 @@ import { PROFILE_READ, PROFILE_WRITE, SUCCESS_STATUS } from "@calcom/platform-co import { userSchemaResponse } from "@calcom/platform-types"; @Controller({ - path: "ee/me", + path: "/me", version: "2", }) @UseGuards(AccessTokenGuard, PermissionsGuard) diff --git a/apps/api/v2/src/ee/provider/provider.controller.ts b/apps/api/v2/src/ee/provider/provider.controller.ts index 9168c8467c..40230e2a27 100644 --- a/apps/api/v2/src/ee/provider/provider.controller.ts +++ b/apps/api/v2/src/ee/provider/provider.controller.ts @@ -20,7 +20,7 @@ import { ApiTags as DocsTags } from "@nestjs/swagger"; import { SUCCESS_STATUS } from "@calcom/platform-constants"; @Controller({ - path: "ee/provider", + path: "/provider", version: "2", }) @DocsTags("Cal provider") diff --git a/apps/api/v2/swagger/documentation.json b/apps/api/v2/swagger/documentation.json index 62e5924af7..b7bed443e3 100644 --- a/apps/api/v2/swagger/documentation.json +++ b/apps/api/v2/swagger/documentation.json @@ -22,7 +22,7 @@ ] } }, - "/api/v2/oauth-clients/{clientId}/users": { + "/v2/oauth-clients/{clientId}/users": { "get": { "operationId": "OAuthClientUsersController_getManagedUsers", "parameters": [ @@ -90,7 +90,7 @@ ] } }, - "/api/v2/oauth-clients/{clientId}/users/{userId}": { + "/v2/oauth-clients/{clientId}/users/{userId}": { "get": { "operationId": "OAuthClientUsersController_getUserById", "parameters": [ @@ -210,7 +210,7 @@ ] } }, - "/api/v2/oauth-clients/{clientId}/users/{userId}/force-refresh": { + "/v2/oauth-clients/{clientId}/users/{userId}/force-refresh": { "post": { "operationId": "OAuthClientUsersController_forceRefresh", "parameters": [ @@ -248,7 +248,7 @@ ] } }, - "/api/v2/oauth-clients": { + "/v2/oauth-clients": { "post": { "operationId": "OAuthClientsController_createOAuthClient", "summary": "", @@ -302,7 +302,7 @@ ] } }, - "/api/v2/oauth-clients/{clientId}": { + "/v2/oauth-clients/{clientId}": { "get": { "operationId": "OAuthClientsController_getOAuthClientById", "summary": "", @@ -404,7 +404,7 @@ ] } }, - "/api/v2/oauth/{clientId}/authorize": { + "/v2/oauth/{clientId}/authorize": { "post": { "operationId": "OAuthFlowController_authorize", "summary": "Authorize an OAuth client", @@ -442,7 +442,7 @@ ] } }, - "/api/v2/oauth/{clientId}/exchange": { + "/v2/oauth/{clientId}/exchange": { "post": { "operationId": "OAuthFlowController_exchange", "summary": "Exchange authorization code for access tokens", @@ -495,7 +495,7 @@ ] } }, - "/api/v2/oauth/{clientId}/refresh": { + "/v2/oauth/{clientId}/refresh": { "post": { "operationId": "OAuthFlowController_refreshAccessToken", "parameters": [ @@ -543,7 +543,7 @@ ] } }, - "/api/v2/event-types": { + "/v2/event-types": { "post": { "operationId": "EventTypesController_createEventType", "parameters": [], @@ -593,7 +593,7 @@ ] } }, - "/api/v2/event-types/{eventTypeId}": { + "/v2/event-types/{eventTypeId}": { "get": { "operationId": "EventTypesController_getEventType", "parameters": [ @@ -689,7 +689,7 @@ ] } }, - "/api/v2/event-types/{username}/{eventSlug}/public": { + "/v2/event-types/{username}/{eventSlug}/public": { "get": { "operationId": "EventTypesController_getPublicEventType", "parameters": [ @@ -743,7 +743,7 @@ ] } }, - "/api/v2/event-types/{username}/public": { + "/v2/event-types/{username}/public": { "get": { "operationId": "EventTypesController_getPublicEventTypes", "parameters": [ @@ -773,7 +773,7 @@ ] } }, - "/api/v2/ee/gcal/oauth/auth-url": { + "/v2/gcal/oauth/auth-url": { "get": { "operationId": "GcalController_redirect", "parameters": [ @@ -803,7 +803,7 @@ ] } }, - "/api/v2/ee/gcal/oauth/save": { + "/v2/gcal/oauth/save": { "get": { "operationId": "GcalController_save", "parameters": [ @@ -841,7 +841,7 @@ ] } }, - "/api/v2/ee/gcal/check": { + "/v2/gcal/check": { "get": { "operationId": "GcalController_check", "parameters": [], @@ -862,7 +862,7 @@ ] } }, - "/api/v2/ee/provider/{clientId}": { + "/v2/provider/{clientId}": { "get": { "operationId": "CalProviderController_verifyClientId", "parameters": [ @@ -892,7 +892,7 @@ ] } }, - "/api/v2/ee/provider/{clientId}/access-token": { + "/v2/provider/{clientId}/access-token": { "get": { "operationId": "CalProviderController_verifyAccessToken", "parameters": [ @@ -922,7 +922,7 @@ ] } }, - "/api/v2/schedules": { + "/v2/schedules": { "post": { "operationId": "SchedulesController_createSchedule", "parameters": [], @@ -972,7 +972,7 @@ ] } }, - "/api/v2/schedules/default": { + "/v2/schedules/default": { "get": { "operationId": "SchedulesController_getDefaultSchedule", "parameters": [], @@ -993,7 +993,7 @@ ] } }, - "/api/v2/schedules/{scheduleId}": { + "/v2/schedules/{scheduleId}": { "get": { "operationId": "SchedulesController_getSchedule", "parameters": [ @@ -1089,7 +1089,7 @@ ] } }, - "/api/v2/ee/me": { + "/v2/me": { "get": { "operationId": "MeController_getMe", "parameters": [], @@ -1139,7 +1139,7 @@ ] } }, - "/api/v2/ee/calendars/busy-times": { + "/v2/calendars/busy-times": { "get": { "operationId": "CalendarsController_getBusyTimes", "parameters": [], @@ -1160,7 +1160,7 @@ ] } }, - "/api/v2/ee/calendars": { + "/v2/calendars": { "get": { "operationId": "CalendarsController_getCalendars", "parameters": [], @@ -1181,7 +1181,7 @@ ] } }, - "/api/v2/ee/bookings": { + "/v2/bookings": { "get": { "operationId": "BookingsController_getBookings", "parameters": [ @@ -1235,7 +1235,16 @@ }, "post": { "operationId": "BookingsController_createBooking", - "parameters": [], + "parameters": [ + { + "name": "x-cal-client-id", + "required": true, + "in": "header", + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -1263,7 +1272,7 @@ ] } }, - "/api/v2/ee/bookings/{bookingUid}": { + "/v2/bookings/{bookingUid}": { "get": { "operationId": "BookingsController_getBooking", "parameters": [ @@ -1293,7 +1302,7 @@ ] } }, - "/api/v2/ee/bookings/{bookingUid}/reschedule": { + "/v2/bookings/{bookingUid}/reschedule": { "get": { "operationId": "BookingsController_getBookingForReschedule", "parameters": [ @@ -1323,7 +1332,7 @@ ] } }, - "/api/v2/ee/bookings/{bookingId}/cancel": { + "/v2/bookings/{bookingId}/cancel": { "post": { "operationId": "BookingsController_cancelBooking", "parameters": [ @@ -1334,6 +1343,14 @@ "schema": { "type": "string" } + }, + { + "name": "x-cal-client-id", + "required": true, + "in": "header", + "schema": { + "type": "string" + } } ], "requestBody": { @@ -1363,10 +1380,19 @@ ] } }, - "/api/v2/ee/bookings/reccuring": { + "/v2/bookings/reccuring": { "post": { "operationId": "BookingsController_createReccuringBooking", - "parameters": [], + "parameters": [ + { + "name": "x-cal-client-id", + "required": true, + "in": "header", + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -1397,10 +1423,19 @@ ] } }, - "/api/v2/ee/bookings/instant": { + "/v2/bookings/instant": { "post": { "operationId": "BookingsController_createInstantBooking", - "parameters": [], + "parameters": [ + { + "name": "x-cal-client-id", + "required": true, + "in": "header", + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -1428,7 +1463,7 @@ ] } }, - "/api/v2/slots/reserve": { + "/v2/slots/reserve": { "post": { "operationId": "SlotsController_reserveSlot", "parameters": [], @@ -1459,7 +1494,7 @@ ] } }, - "/api/v2/slots/selected-slot": { + "/v2/slots/selected-slot": { "delete": { "operationId": "SlotsController_deleteSelectedSlot", "parameters": [], @@ -1480,7 +1515,7 @@ ] } }, - "/api/v2/slots/available": { + "/v2/slots/available": { "get": { "operationId": "SlotsController_getAvailableSlots", "parameters": [], @@ -1501,7 +1536,7 @@ ] } }, - "/api/v2/timezones": { + "/v2/timezones": { "get": { "operationId": "TimezonesController_getTimeZones", "parameters": [], diff --git a/packages/platform/atoms/hooks/useCalendarsBusyTimes.ts b/packages/platform/atoms/hooks/useCalendarsBusyTimes.ts index 09015379e8..69fe8e31c5 100644 --- a/packages/platform/atoms/hooks/useCalendarsBusyTimes.ts +++ b/packages/platform/atoms/hooks/useCalendarsBusyTimes.ts @@ -21,7 +21,7 @@ export const useCalendarsBusyTimes = ({ onError, enabled, ...rest }: UseCalendar ], queryFn: () => { return http - .get>("/ee/calendars/busy-times", { + .get>("/calendars/busy-times", { params: rest, }) .then((res) => { diff --git a/packages/platform/atoms/hooks/useConnectedCalendars.tsx b/packages/platform/atoms/hooks/useConnectedCalendars.tsx index 33be4ec20b..40902cbd9d 100644 --- a/packages/platform/atoms/hooks/useConnectedCalendars.tsx +++ b/packages/platform/atoms/hooks/useConnectedCalendars.tsx @@ -11,7 +11,7 @@ export const useConnectedCalendars = (props: { enabled?: boolean }) => { const calendars = useQuery({ queryKey: [QUERY_KEY], queryFn: () => { - return http.get>("/ee/calendars").then((res) => { + return http.get>("/calendars").then((res) => { if (res.data.status === SUCCESS_STATUS) { return (res.data as ApiSuccessResponse)?.data; } diff --git a/packages/platform/atoms/hooks/useCreateBooking.ts b/packages/platform/atoms/hooks/useCreateBooking.ts index 521423dad0..afca4f5406 100644 --- a/packages/platform/atoms/hooks/useCreateBooking.ts +++ b/packages/platform/atoms/hooks/useCreateBooking.ts @@ -23,7 +23,7 @@ export const useCreateBooking = ( ) => { const createBooking = useMutation, Error, BookingCreateBody>({ mutationFn: (data) => { - return http.post>("/ee/bookings", data).then((res) => { + return http.post>("/bookings", data).then((res) => { if (res.data.status === SUCCESS_STATUS) { return res.data; } diff --git a/packages/platform/atoms/hooks/useCreateInstantBooking.ts b/packages/platform/atoms/hooks/useCreateInstantBooking.ts index 303b6f2e7f..6196e3bca8 100644 --- a/packages/platform/atoms/hooks/useCreateInstantBooking.ts +++ b/packages/platform/atoms/hooks/useCreateInstantBooking.ts @@ -23,7 +23,7 @@ export const useCreateInstantBooking = ( ) => { const createInstantBooking = useMutation, Error, BookingCreateBody>({ mutationFn: (data) => { - return http.post>("/ee/bookings/instant", data).then((res) => { + return http.post>("/bookings/instant", data).then((res) => { if (res.data.status === SUCCESS_STATUS) { return res.data; } diff --git a/packages/platform/atoms/hooks/useCreateRecurringBooking.ts b/packages/platform/atoms/hooks/useCreateRecurringBooking.ts index 87b537a47c..7eb97badcb 100644 --- a/packages/platform/atoms/hooks/useCreateRecurringBooking.ts +++ b/packages/platform/atoms/hooks/useCreateRecurringBooking.ts @@ -27,9 +27,7 @@ export const useCreateRecurringBooking = ( RecurringBookingCreateBody[] >({ mutationFn: (data) => { - return http - .post>("/ee/bookings/recurring", data) - .then((res) => res.data); + return http.post>("/bookings/recurring", data).then((res) => res.data); }, onSuccess: (data) => { if (data.status === SUCCESS_STATUS) { diff --git a/packages/platform/atoms/hooks/useGcal.ts b/packages/platform/atoms/hooks/useGcal.ts index dbce8e31e6..3dd936ce30 100644 --- a/packages/platform/atoms/hooks/useGcal.ts +++ b/packages/platform/atoms/hooks/useGcal.ts @@ -16,7 +16,7 @@ export const useGcal = ({ isAuth, onCheckError }: useGcalProps) => { const redirectToGcalOAuth = () => { http - ?.get("/ee/gcal/oauth/auth-url") + ?.get("/gcal/oauth/auth-url") .then(({ data: responseBody }) => { if (responseBody.data?.authUrl) { window.location.href = responseBody.data.authUrl; @@ -28,7 +28,7 @@ export const useGcal = ({ isAuth, onCheckError }: useGcalProps) => { useEffect(() => { if (isAuth) { http - ?.get("/ee/gcal/check") + ?.get("/gcal/check") .then(() => setAllowConnect(false)) .catch((err) => { setAllowConnect(true); diff --git a/packages/platform/constants/api.ts b/packages/platform/constants/api.ts index 747edf523d..15a1df0b68 100644 --- a/packages/platform/constants/api.ts +++ b/packages/platform/constants/api.ts @@ -1,10 +1,10 @@ export const BASE_URL = "http://localhost:5555"; export const API_VERSION = "v2"; export const V2_ENDPOINTS = { - me: "ee/me", + me: "me", availability: "schedules", eventTypes: "event-types", - bookings: "ee/bookings", + bookings: "bookings", }; export const SUCCESS_STATUS = "success"; diff --git a/packages/platform/examples/base/README.md b/packages/platform/examples/base/README.md index b9fd5133e1..baf47d5c43 100644 --- a/packages/platform/examples/base/README.md +++ b/packages/platform/examples/base/README.md @@ -29,7 +29,7 @@ REDIS_URL="redis://localhost:6379" 2. Open ".env" file and paste client id from step 8 in `NEXT_PUBLIC_X_CAL_ID` and client secret in `X_CAL_SECRET_KEY`. If in step 2 you used the same environment variables, then `NEXT_PUBLIC_CALCOM_API_URL` can stay as is. Otherwise adjust the port to point to the same `API_PORT` as you used in step 2. 10. Navigate to example app and setup database by running `rm -f prisma/dev.db && yarn prisma db push`. 11. Start the example app by running `yarn dev` and go to `http://localhost:4321`. -12. In the Google Cloud Console "API & Services" "Credentials" `https://console.cloud.google.com/apis/credentials` open web project setup in step 1 and add `http://localhost:5555/api/v2/ee/gcal/oauth/save` to the authorized redirect URIs. +12. In the Google Cloud Console "API & Services" "Credentials" `https://console.cloud.google.com/apis/credentials` open web project setup in step 1 and add `http://localhost:5555/v2/gcal/oauth/save` to the authorized redirect URIs. Screenshot 2024-03-21 at 09 42 36 diff --git a/packages/platform/sdk/src/swagger-types.d.ts b/packages/platform/sdk/src/swagger-types.d.ts index edca446943..f64b6d71dc 100644 --- a/packages/platform/sdk/src/swagger-types.d.ts +++ b/packages/platform/sdk/src/swagger-types.d.ts @@ -7,18 +7,18 @@ export interface paths { "/health": { get: operations["AppController_getHealth"]; }; - "/api/v2/events/public": { + "/v2/events/public": { get: operations["EventsController_getPublicEvent"]; }; - "/api/v2/oauth-clients/{clientId}/users": { + "/v2/oauth-clients/{clientId}/users": { post: operations["OAuthClientUsersController_createUser"]; }; - "/api/v2/oauth-clients/{clientId}/users/{userId}": { + "/v2/oauth-clients/{clientId}/users/{userId}": { get: operations["OAuthClientUsersController_getUserById"]; delete: operations["OAuthClientUsersController_deleteUser"]; patch: operations["OAuthClientUsersController_updateUser"]; }; - "/api/v2/oauth-clients": { + "/v2/oauth-clients": { /** * @description ⚠️ First, this endpoint requires `Cookie: next-auth.session-token=eyJhbGciOiJ` header. Log into Cal web app using owner of organization that was created after visiting `/settings/organizations/new`, refresh swagger docs, and the cookie will be added to requests automatically to pass the NextAuthGuard. * Second, make sure that the logged in user has organizationId set to pass the OrganizationRolesGuard guard. @@ -30,7 +30,7 @@ export interface paths { */ post: operations["OAuthClientsController_createOAuthClient"]; }; - "/api/v2/oauth-clients/{clientId}": { + "/v2/oauth-clients/{clientId}": { /** * @description ⚠️ First, this endpoint requires `Cookie: next-auth.session-token=eyJhbGciOiJ` header. Log into Cal web app using owner of organization that was created after visiting `/settings/organizations/new`, refresh swagger docs, and the cookie will be added to requests automatically to pass the NextAuthGuard. * Second, make sure that the logged in user has organizationId set to pass the OrganizationRolesGuard guard. @@ -47,89 +47,89 @@ export interface paths { */ patch: operations["OAuthClientsController_updateOAuthClient"]; }; - "/api/v2/oauth/{clientId}/authorize": { + "/v2/oauth/{clientId}/authorize": { /** * Authorize an OAuth client * @description Redirects the user to the specified 'redirect_uri' with an authorization code in query parameter if the client is authorized successfully. The code is then exchanged for access and refresh tokens via the `/exchange` endpoint. */ post: operations["OAuthFlowController_authorize"]; }; - "/api/v2/oauth/{clientId}/exchange": { + "/v2/oauth/{clientId}/exchange": { /** * Exchange authorization code for access tokens * @description Exchanges the authorization code received from the `/authorize` endpoint for access and refresh tokens. The authorization code should be provided in the 'Authorization' header prefixed with 'Bearer '. */ post: operations["OAuthFlowController_exchange"]; }; - "/api/v2/oauth/{clientId}/refresh": { + "/v2/oauth/{clientId}/refresh": { post: operations["OAuthFlowController_refreshAccessToken"]; }; - "/api/v2/event-types": { + "/v2/event-types": { get: operations["EventTypesController_getEventTypes"]; post: operations["EventTypesController_createEventType"]; }; - "/api/v2/event-types/{eventTypeId}": { + "/v2/event-types/{eventTypeId}": { get: operations["EventTypesController_getEventType"]; }; - "/api/v2/event-types/{username}/public": { + "/v2/event-types/{username}/public": { get: operations["EventTypesController_getPublicEventTypes"]; }; - "/api/v2/platform/gcal/oauth/auth-url": { + "/v2/gcal/oauth/auth-url": { get: operations["GcalController_redirect"]; }; - "/api/v2/platform/gcal/oauth/save": { + "/v2/gcal/oauth/save": { get: operations["GcalController_save"]; }; - "/api/v2/platform/gcal/check": { + "/v2/gcal/check": { get: operations["GcalController_check"]; }; - "/api/v2/platform/provider/{clientId}": { + "/v2/provider/{clientId}": { get: operations["CalProviderController_verifyClientId"]; }; - "/api/v2/platform/provider/{clientId}/access-token": { + "/v2/provider/{clientId}/access-token": { get: operations["CalProviderController_verifyAccessToken"]; }; - "/api/v2/schedules": { + "/v2/schedules": { get: operations["SchedulesController_getSchedules"]; post: operations["SchedulesController_createSchedule"]; }; - "/api/v2/schedules/default": { + "/v2/schedules/default": { get: operations["SchedulesController_getDefaultSchedule"]; }; - "/api/v2/schedules/time-zones": { + "/v2/schedules/time-zones": { get: operations["SchedulesController_getTimeZones"]; }; - "/api/v2/schedules/{scheduleId}": { + "/v2/schedules/{scheduleId}": { get: operations["SchedulesController_getSchedule"]; delete: operations["SchedulesController_deleteSchedule"]; patch: operations["SchedulesController_updateSchedule"]; }; - "/api/v2/me": { + "/v2/me": { get: operations["MeController_getMe"]; patch: operations["MeController_updateMe"]; }; - "/api/v2/ee/calendars/busy-times": { + "/v2/calendars/busy-times": { get: operations["CalendarsController_getBusyTimes"]; }; - "/api/v2/ee/calendars": { + "/v2/calendars": { get: operations["CalendarsController_getCalendars"]; }; - "/api/v2/ee/bookings": { + "/v2/bookings": { post: operations["BookingsController_createBooking"]; }; - "/api/v2/ee/bookings/reccuring": { + "/v2/bookings/reccuring": { post: operations["BookingsController_createReccuringBooking"]; }; - "/api/v2/ee/bookings/instant": { + "/v2/bookings/instant": { post: operations["BookingsController_createInstantBooking"]; }; - "/api/v2/slots/reserve": { + "/v2/slots/reserve": { post: operations["SlotsController_reserveSlot"]; }; - "/api/v2/slots/selected-slot": { + "/v2/slots/selected-slot": { delete: operations["SlotsController_deleteSelectedSlot"]; }; - "/api/v2/slots/available": { + "/v2/slots/available": { get: operations["SlotsController_getAvailableSlots"]; }; }