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
This commit is contained in:
Morgan authored and GitHub committed 2024-04-13 22:16:37 +00:00
1 parent ac3d7c9fae
commit 38e62786e4
19 files changed
+139 -106

No files matched your search

@@ -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();
}
}
@@ -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) => {
@@ -68,7 +68,7 @@ const DEFAULT_PLATFORM_PARAMS = {
};
@Controller({
path: "ee/bookings",
path: "/bookings",
version: "2",
})
@UseGuards(PermissionsGuard)
@@ -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)
@@ -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);
+2 -2
View File
@@ -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)
@@ -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<UserResponse> = 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 () => {
+1 -1
View File
@@ -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)
@@ -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")
+71 -36
View File
@@ -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": [],