feat: support updating cal video settings in API v2 (#21784)
* feat: support updating cal video settings in API v2 * chore: update descriptio * feat: support create event type * test: add test for updating event type * test: add test for create event type * chore: undo openapi * chore: bump libraries * Revert "chore: bump libraries" This reverts commit bdf36d09b021fc531497a7b7ea66ab9c52b7d136. * chore: bump libraries --------- Co-authored-by: Lauris Skraucis <[email protected]> Co-authored-by: supalarry <[email protected]>
This commit is contained in:
15 files changed
+669
-2443
No files matched your search
@@ -37,7 +37,7 @@
|
||||
"@axiomhq/winston": "^1.2.0",
|
||||
"@calcom/platform-constants": "*",
|
||||
"@calcom/platform-enums": "*",
|
||||
"@calcom/platform-libraries": "npm:@calcom/[email protected]5",
|
||||
"@calcom/platform-libraries": "npm:@calcom/[email protected]7",
|
||||
"@calcom/platform-libraries-0.0.2": "npm:@calcom/[email protected]",
|
||||
"@calcom/platform-types": "*",
|
||||
"@calcom/platform-utils": "*",
|
||||
|
||||
+44
@@ -962,6 +962,10 @@ describe("Event types Endpoints", () => {
|
||||
title: newTitle,
|
||||
scheduleId: secondSchedule.id,
|
||||
lengthInMinutesOptions: [15, 30],
|
||||
calVideoSettings: {
|
||||
disableRecordingForGuests: true,
|
||||
disableRecordingForOrganizer: true,
|
||||
},
|
||||
bookingFields: [
|
||||
nameBookingField,
|
||||
{
|
||||
@@ -1082,6 +1086,12 @@ describe("Event types Endpoints", () => {
|
||||
body.lockTimeZoneToggleOnBookingPage
|
||||
);
|
||||
expect(updatedEventType.color).toEqual(body.color);
|
||||
expect(updatedEventType.calVideoSettings?.disableRecordingForGuests).toEqual(
|
||||
body.calVideoSettings?.disableRecordingForGuests
|
||||
);
|
||||
expect(updatedEventType.calVideoSettings?.disableRecordingForOrganizer).toEqual(
|
||||
body.calVideoSettings?.disableRecordingForOrganizer
|
||||
);
|
||||
|
||||
eventType.title = newTitle;
|
||||
eventType.scheduleId = secondSchedule.id;
|
||||
@@ -1841,6 +1851,40 @@ describe("Event types Endpoints", () => {
|
||||
expect(slug2).not.toEqual(slug);
|
||||
});
|
||||
});
|
||||
|
||||
it("should create event type with cal video settings", async () => {
|
||||
const body: CreateEventTypeInput_2024_06_14 = {
|
||||
title: "event type with cal video settings",
|
||||
slug: "event-type-with-cal-video-settings",
|
||||
lengthInMinutes: 60,
|
||||
calVideoSettings: {
|
||||
disableRecordingForGuests: true,
|
||||
disableRecordingForOrganizer: true,
|
||||
},
|
||||
locations: [
|
||||
{
|
||||
type: "integration",
|
||||
integration: "cal-video",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.post("/api/v2/event-types")
|
||||
.set(CAL_API_VERSION_HEADER, VERSION_2024_06_14)
|
||||
.send(body)
|
||||
.expect(201)
|
||||
.then(async (response) => {
|
||||
const responseBody: ApiSuccessResponse<EventTypeOutput_2024_06_14> = response.body;
|
||||
const createdEventType = responseBody.data;
|
||||
expect(createdEventType).toHaveProperty("id");
|
||||
expect(createdEventType.title).toEqual(body.title);
|
||||
expect(createdEventType.locations).toEqual(body.locations);
|
||||
expect(createdEventType.calVideoSettings?.disableRecordingForGuests).toEqual(true);
|
||||
expect(createdEventType.calVideoSettings?.disableRecordingForOrganizer).toEqual(true);
|
||||
firstCreatedEventType = responseBody.data;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
||||
@@ -12,13 +12,20 @@ export class EventTypesRepository_2024_06_14 {
|
||||
userId: number,
|
||||
body: Omit<InputEventTransformed_2024_06_14, "destinationCalendar">
|
||||
) {
|
||||
const { calVideoSettings, ...restBody } = body;
|
||||
|
||||
return this.dbWrite.prisma.eventType.create({
|
||||
data: {
|
||||
...body,
|
||||
...restBody,
|
||||
userId,
|
||||
locations: body.locations,
|
||||
bookingFields: body.bookingFields,
|
||||
users: { connect: { id: userId } },
|
||||
...(calVideoSettings && {
|
||||
calVideoSettings: {
|
||||
create: calVideoSettings,
|
||||
},
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -71,7 +78,7 @@ export class EventTypesRepository_2024_06_14 {
|
||||
async getEventTypeById(eventTypeId: number) {
|
||||
return this.dbRead.prisma.eventType.findUnique({
|
||||
where: { id: eventTypeId },
|
||||
include: { users: true, schedule: true, destinationCalendar: true },
|
||||
include: { users: true, schedule: true, destinationCalendar: true, calVideoSettings: true },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -15,7 +15,7 @@ import {
|
||||
BookingFieldSchema,
|
||||
} from "@/ee/event-types/event-types_2024_06_14/transformers";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import type { EventType, User, Schedule, DestinationCalendar } from "@prisma/client";
|
||||
import type { EventType, User, Schedule, DestinationCalendar, CalVideoSettings } from "@prisma/client";
|
||||
|
||||
import {
|
||||
userMetadata,
|
||||
@@ -37,6 +37,7 @@ type EventTypeRelations = {
|
||||
users: User[];
|
||||
schedule: Schedule | null;
|
||||
destinationCalendar?: DestinationCalendar | null;
|
||||
calVideoSettings?: CalVideoSettings | null;
|
||||
};
|
||||
export type DatabaseEventType = Omit<EventType, "allowReschedulingCancelledBookings"> & EventTypeRelations;
|
||||
|
||||
@@ -87,6 +88,7 @@ type Input = Pick<
|
||||
| "useEventTypeDestinationCalendarEmail"
|
||||
| "hideCalendarEventDetails"
|
||||
| "hideOrganizerEmail"
|
||||
| "calVideoSettings"
|
||||
>;
|
||||
|
||||
@Injectable()
|
||||
@@ -124,6 +126,7 @@ export class OutputEventTypesService_2024_06_14 {
|
||||
useEventTypeDestinationCalendarEmail,
|
||||
hideCalendarEventDetails,
|
||||
hideOrganizerEmail,
|
||||
calVideoSettings,
|
||||
} = databaseEventType;
|
||||
|
||||
const locations = this.transformLocations(databaseEventType.locations);
|
||||
@@ -199,6 +202,7 @@ export class OutputEventTypesService_2024_06_14 {
|
||||
useDestinationCalendarEmail: useEventTypeDestinationCalendarEmail,
|
||||
hideCalendarEventDetails,
|
||||
hideOrganizerEmail,
|
||||
calVideoSettings,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { OutputEventTypesService_2024_06_14 } from "@/ee/event-types/event-types
|
||||
import { TeamsEventTypesRepository } from "@/modules/teams/event-types/teams-event-types.repository";
|
||||
import { UsersRepository } from "@/modules/users/users.repository";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import type { EventType, User, Schedule, Host, DestinationCalendar } from "@prisma/client";
|
||||
import type { EventType, User, Schedule, Host, DestinationCalendar, CalVideoSettings } from "@prisma/client";
|
||||
import { SchedulingType, Team } from "@prisma/client";
|
||||
|
||||
import { HostPriority, TeamEventTypeResponseHost } from "@calcom/platform-types";
|
||||
@@ -16,6 +16,7 @@ type EventTypeRelations = {
|
||||
Team,
|
||||
"bannerUrl" | "name" | "logoUrl" | "slug" | "weekStart" | "brandColor" | "darkBrandColor" | "theme"
|
||||
> | null;
|
||||
calVideoSettings?: CalVideoSettings | null;
|
||||
};
|
||||
export type DatabaseTeamEventType = EventType & EventTypeRelations;
|
||||
|
||||
@@ -72,6 +73,7 @@ type Input = Pick<
|
||||
| "hideCalendarEventDetails"
|
||||
| "hideOrganizerEmail"
|
||||
| "team"
|
||||
| "calVideoSettings"
|
||||
>;
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -12,7 +12,13 @@ export class TeamsEventTypesRepository {
|
||||
id: eventTypeId,
|
||||
teamId,
|
||||
},
|
||||
include: { users: true, schedule: true, hosts: true, destinationCalendar: true },
|
||||
include: {
|
||||
users: true,
|
||||
schedule: true,
|
||||
hosts: true,
|
||||
destinationCalendar: true,
|
||||
calVideoSettings: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,6 +39,7 @@ export class TeamsEventTypesRepository {
|
||||
}
|
||||
: true,
|
||||
destinationCalendar: true,
|
||||
calVideoSettings: true,
|
||||
team: {
|
||||
select: {
|
||||
bannerUrl: true,
|
||||
@@ -82,6 +89,7 @@ export class TeamsEventTypesRepository {
|
||||
schedule: true,
|
||||
hosts: true,
|
||||
destinationCalendar: true,
|
||||
calVideoSettings: true,
|
||||
team: {
|
||||
select: {
|
||||
bannerUrl: true,
|
||||
@@ -101,7 +109,13 @@ export class TeamsEventTypesRepository {
|
||||
async getEventTypeById(eventTypeId: number) {
|
||||
return this.dbRead.prisma.eventType.findUnique({
|
||||
where: { id: eventTypeId },
|
||||
include: { users: true, schedule: true, hosts: true, destinationCalendar: true },
|
||||
include: {
|
||||
users: true,
|
||||
schedule: true,
|
||||
hosts: true,
|
||||
destinationCalendar: true,
|
||||
calVideoSettings: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13757,6 +13757,71 @@
|
||||
"data"
|
||||
]
|
||||
},
|
||||
"BookerLayouts_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"defaultLayout": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"month",
|
||||
"week",
|
||||
"column"
|
||||
]
|
||||
},
|
||||
"enabledLayouts": {
|
||||
"type": "array",
|
||||
"description": "Array of valid layouts - month, week or column",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"month",
|
||||
"week",
|
||||
"column"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"defaultLayout",
|
||||
"enabledLayouts"
|
||||
]
|
||||
},
|
||||
"EventTypeColor_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"lightThemeHex": {
|
||||
"type": "string",
|
||||
"description": "Color used for event types in light theme",
|
||||
"example": "#292929"
|
||||
},
|
||||
"darkThemeHex": {
|
||||
"type": "string",
|
||||
"description": "Color used for event types in dark theme",
|
||||
"example": "#fafafa"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"lightThemeHex",
|
||||
"darkThemeHex"
|
||||
]
|
||||
},
|
||||
"DestinationCalendar_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"integration": {
|
||||
"type": "string",
|
||||
"description": "The integration type of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the integration type of your connected calendars."
|
||||
},
|
||||
"externalId": {
|
||||
"type": "string",
|
||||
"description": "The external ID of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the external IDs of your connected calendars."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"integration",
|
||||
"externalId"
|
||||
]
|
||||
},
|
||||
"InputAddressLocation_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -14873,70 +14938,22 @@
|
||||
"type"
|
||||
]
|
||||
},
|
||||
"BookerLayouts_2024_06_14": {
|
||||
"CalVideoSettings": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"defaultLayout": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"month",
|
||||
"week",
|
||||
"column"
|
||||
]
|
||||
"disableRecordingForOrganizer": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the organizer will not be able to record the meeting"
|
||||
},
|
||||
"enabledLayouts": {
|
||||
"type": "array",
|
||||
"description": "Array of valid layouts - month, week or column",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"month",
|
||||
"week",
|
||||
"column"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"defaultLayout",
|
||||
"enabledLayouts"
|
||||
]
|
||||
},
|
||||
"EventTypeColor_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"lightThemeHex": {
|
||||
"type": "string",
|
||||
"description": "Color used for event types in light theme",
|
||||
"example": "#292929"
|
||||
"disableRecordingForGuests": {
|
||||
"type": "boolean",
|
||||
"description": "If true, the guests will not be able to record the meeting"
|
||||
},
|
||||
"darkThemeHex": {
|
||||
"type": "string",
|
||||
"description": "Color used for event types in dark theme",
|
||||
"example": "#fafafa"
|
||||
"redirectUrlOnExit": {
|
||||
"type": "object",
|
||||
"description": "URL to which participants are redirected when they exit the call"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"lightThemeHex",
|
||||
"darkThemeHex"
|
||||
]
|
||||
},
|
||||
"DestinationCalendar_2024_06_14": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"integration": {
|
||||
"type": "string",
|
||||
"description": "The integration type of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the integration type of your connected calendars."
|
||||
},
|
||||
"externalId": {
|
||||
"type": "string",
|
||||
"description": "The external ID of the destination calendar. Refer to the /api/v2/calendars endpoint to retrieve the external IDs of your connected calendars."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"integration",
|
||||
"externalId"
|
||||
]
|
||||
}
|
||||
},
|
||||
"CreateEventTypeInput_2024_06_14": {
|
||||
"type": "object",
|
||||
@@ -15160,7 +15177,7 @@
|
||||
},
|
||||
"customName": {
|
||||
"type": "string",
|
||||
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
|
||||
"description": "Customizable event name with valid variables:\n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name},\n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION},\n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
|
||||
"example": "{Event type title} between {Organiser} and {Scheduler}"
|
||||
},
|
||||
"destinationCalendar": {
|
||||
@@ -15181,6 +15198,14 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
@@ -16834,6 +16859,14 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ownerId": {
|
||||
"type": "number",
|
||||
"example": 10
|
||||
@@ -17175,6 +17208,14 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"locations": {
|
||||
"type": "array",
|
||||
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
|
||||
@@ -18974,7 +19015,7 @@
|
||||
},
|
||||
"customName": {
|
||||
"type": "string",
|
||||
"description": "Customizable event name with valid variables: \n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name}, \n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION}, \n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
|
||||
"description": "Customizable event name with valid variables:\n {Event type title}, {Organiser}, {Scheduler}, {Location}, {Organiser first name},\n {Scheduler first name}, {Scheduler last name}, {Event duration}, {LOCATION},\n {HOST/ATTENDEE}, {HOST}, {ATTENDEE}, {USER}",
|
||||
"example": "{Event type title} between {Organiser} and {Scheduler}"
|
||||
},
|
||||
"destinationCalendar": {
|
||||
@@ -18995,6 +19036,14 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"schedulingType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -19420,6 +19469,15 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"nullable": true,
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"teamId": {
|
||||
"type": "number"
|
||||
},
|
||||
@@ -19858,6 +19916,14 @@
|
||||
"type": "boolean",
|
||||
"description": "Boolean to Hide organizer's email address from the booking screen, email notifications, and calendar events"
|
||||
},
|
||||
"calVideoSettings": {
|
||||
"description": "Cal video settings for the event type",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/CalVideoSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hosts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
Reference in new issue
Block a user