Skip to content

Scheduling infrastructure for absolutely everyone.

chore: open disableGuests for event-types apiv2 (#15001)

Morgan3942df369d71
diff --git a/apps/api/v2/src/ee/event-types/controllers/event-types.controller.e2e-spec.ts b/apps/api/v2/src/ee/event-types/controllers/event-types.controller.e2e-spec.ts
index 77678f83878..870aed625ac 100644
--- a/apps/api/v2/src/ee/event-types/controllers/event-types.controller.e2e-spec.ts
+++ b/apps/api/v2/src/ee/event-types/controllers/event-types.controller.e2e-spec.ts
@@ -131,6 +131,7 @@ describe("Event types Endpoints", () => {
description: "A description of the test event type.",
length: 60,
hidden: false,
+ disableGuests: true,
locations: [
{
type: "Online",
@@ -148,6 +149,7 @@ describe("Event types Endpoints", () => {
const responseBody: ApiSuccessResponse<EventType> = response.body;
expect(responseBody.data).toHaveProperty("id");
expect(responseBody.data.title).toEqual(body.title);
+ expect(responseBody.data.disableGuests).toEqual(body.disableGuests);
eventType = responseBody.data;
});
});
@@ -157,14 +159,19 @@ describe("Event types Endpoints", () => {
const body: UpdateEventTypeInput = {
title: newTitle,
+ disableGuests: false,
};
return request(app.getHttpServer())
.patch(`/api/v2/event-types/${eventType.id}`)
.send(body)
.expect(200)
- .then(async () => {
+ .then(async (response) => {
+ const responseBody: ApiSuccessResponse<EventType> = response.body;
+ expect(responseBody.data.title).toEqual(newTitle);
+ expect(responseBody.data.disableGuests).toEqual(body.disableGuests);
eventType.title = newTitle;
+ eventType.disableGuests = responseBody.data.disableGuests ?? false;
});
});
diff --git a/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts b/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts
index 469ea1f4efd..fb5b380164e 100644
--- a/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts
+++ b/apps/api/v2/src/ee/event-types/inputs/create-event-type.input.ts
@@ -41,6 +41,10 @@ export class CreateEventTypeInput {
@IsArray()
locations?: EventTypeLocation[];
+ @IsBoolean()
+ @IsOptional()
+ disableGuests?: boolean;
+
// @ApiHideProperty()
// @IsOptional()
// @IsNumber()
diff --git a/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts b/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts
index d03e451d44f..68a64d4204f 100644
--- a/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts
+++ b/apps/api/v2/src/ee/event-types/inputs/update-event-type.input.ts
@@ -322,9 +322,9 @@ export class UpdateEventTypeInput {
// @IsOptional()
// recurringEvent?: RecurringEvent;
- // @IsBoolean()
- // @IsOptional()
- // disableGuests?: boolean;
+ @IsBoolean()
+ @IsOptional()
+ disableGuests?: boolean;
// @IsBoolean()
// @IsOptional()
diff --git a/apps/api/v2/swagger/documentation.json b/apps/api/v2/swagger/documentation.json
index ee4d0fba91d..ffc41ecf726 100644
--- a/apps/api/v2/swagger/documentation.json
+++ b/apps/api/v2/swagger/documentation.json
@@ -404,6 +404,38 @@
]
}
},
+ "/v2/oauth-clients/{clientId}/managed-users": {
+ "get": {
+ "operationId": "OAuthClientsController_getOAuthClientManagedUsersById",
+ "summary": "",
+ "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.\nSecond, make sure that the logged in user has organizationId set to pass the OrganizationRolesGuard guard.",
+ "parameters": [
+ {
+ "name": "clientId",
+ "required": true,
+ "in": "path",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetManagedUsersOutput"
+ }
+ }
+ }
+ }
+ },
+ "tags": [
+ "OAuth - development only"
+ ]
+ }
+ },
"/v2/oauth/{clientId}/authorize": {
"post": {
"operationId": "OAuthFlowController_authorize",
@@ -2067,6 +2099,9 @@
"items": {
"$ref": "#/components/schemas/EventTypeLocation"
}
+ },
+ "disableGuests": {
+ "type": "boolean"
}
},
"required": [
@@ -2749,6 +2784,9 @@
"items": {
"$ref": "#/components/schemas/EventTypeLocation"
}
+ },
+ "disableGuests": {
+ "type": "boolean"
}
}
},
diff --git a/packages/prisma/zod/custom/eventtype.ts b/packages/prisma/zod/custom/eventtype.ts
index f3a9f49d2db..fb77284881e 100755
--- a/packages/prisma/zod/custom/eventtype.ts
+++ b/packages/prisma/zod/custom/eventtype.ts
@@ -14,6 +14,7 @@ export const createEventTypeInput = z.object({
schedulingType: z.nativeEnum(SchedulingType).nullish(),
locations: imports.eventTypeLocations,
metadata: imports.EventTypeMetaDataSchema.optional(),
+ disableGuests: z.boolean().optional(),
})
.partial({ hidden: true, locations: true })
.refine((data) => (data.teamId ? data.teamId && data.schedulingType : true), {