feat: authentication secured event types (#23217)

* feat: EventType bookingRequiresAuthentication column

* feat: toggle EventType bookingRequiresAuthentication via api

* feat: check bookingRequiresAuthentication when booking

* docs: v2 swagger

* fix: ts error

* refactor: use Forbidden exception instead of Unauthorized

* refactor: use findFirst instead of unique

* fix: only count accepted memberships

* fix: orgs schedules docs

* regenerate docs

* chore: update platform libraries

* fix: unit test

* fix: e2e test
This commit is contained in:
Lauris Skraucis
2025-08-22 15:22:50 +01:00
committed by GitHub
parent aea6e105e6
commit e0dc2ba03a
25 changed files with 810 additions and 17 deletions
+235
View File
@@ -5315,6 +5315,95 @@
"tags": ["Orgs / Teams / Routing forms / Responses"]
}
},
"/v2/organizations/{orgId}/teams/{teamId}/schedules": {
"get": {
"operationId": "OrganizationsTeamsSchedulesController_getTeamSchedules",
"summary": "Get all team member schedules",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "take",
"required": false,
"in": "query",
"description": "Maximum number of items to return",
"example": 25,
"schema": {
"minimum": 1,
"maximum": 250,
"default": 250,
"type": "number"
}
},
{
"name": "skip",
"required": false,
"in": "query",
"description": "Number of items to skip",
"example": 0,
"schema": {
"minimum": 0,
"default": 0,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSchedulesOutput_2024_06_11"
}
}
}
}
},
"tags": ["Orgs / Teams / Schedules"]
}
},
"/v2/organizations/{orgId}/teams/{teamId}/stripe/connect": {
"get": {
"operationId": "OrganizationsStripeController_getTeamStripeConnectUrl",
@@ -5482,6 +5571,22 @@
"type": "string"
}
},
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "userId",
"required": true,
@@ -12629,6 +12734,69 @@
"tags": ["Teams / Memberships"]
}
},
"/v2/teams/{teamId}/schedules": {
"get": {
"operationId": "TeamsSchedulesController_getTeamSchedules",
"summary": "Get all team member schedules",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "value must be `Bearer <token>` where `<token>` is api key prefixed with cal_ or managed user access token",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "take",
"required": false,
"in": "query",
"description": "Maximum number of items to return",
"example": 25,
"schema": {
"minimum": 1,
"maximum": 250,
"default": 250,
"type": "number"
}
},
{
"name": "skip",
"required": false,
"in": "query",
"description": "Number of items to skip",
"example": 0,
"schema": {
"minimum": 0,
"default": 0,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSchedulesOutput_2024_06_11"
}
}
}
}
},
"tags": ["Teams / Schedules"]
}
},
"/v2/teams/{teamId}/verified-resources/emails/verification-code/request": {
"post": {
"operationId": "TeamsVerifiedResourcesController_requestEmailVerificationCode",
@@ -15566,6 +15734,14 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"default": false,
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"locations": {
"type": "array",
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
@@ -17045,6 +17221,13 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"ownerId": {
"type": "number",
"example": 10
@@ -17074,6 +17257,8 @@
"successRedirectUrl",
"isInstantEvent",
"scheduleId",
"hidden",
"bookingRequiresAuthentication",
"ownerId",
"users"
]
@@ -17372,6 +17557,14 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"default": false,
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"locations": {
"type": "array",
"description": "Locations where the event will take place. If not provided, cal video link will be used as the location.",
@@ -18935,6 +19128,14 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"default": false,
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"schedulingType": {
"type": "string",
"enum": ["collective", "roundRobin", "managed"],
@@ -19338,6 +19539,13 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"teamId": {
"type": "number"
},
@@ -19747,6 +19955,14 @@
}
]
},
"hidden": {
"type": "boolean"
},
"bookingRequiresAuthentication": {
"type": "boolean",
"default": false,
"description": "Boolean to require authentication for booking this event type via api. If true, only authenticated users can book this event type."
},
"hosts": {
"type": "array",
"items": {
@@ -20844,6 +21060,7 @@
},
"unit": {
"type": "object",
"enum": ["hour", "minute", "day"],
"description": "Unit for the offset time",
"example": "hour"
}
@@ -20864,6 +21081,7 @@
"type": {
"type": "string",
"default": "beforeEvent",
"enum": ["beforeEvent"],
"description": "Trigger type for the workflow",
"example": "beforeEvent"
}
@@ -20884,6 +21102,7 @@
"type": {
"type": "string",
"default": "afterEvent",
"enum": ["afterEvent"],
"description": "Trigger type for the workflow",
"example": "afterEvent"
}
@@ -20896,6 +21115,7 @@
"type": {
"type": "string",
"default": "eventCancelled",
"enum": ["eventCancelled"],
"description": "Trigger type for the workflow"
}
},
@@ -20907,6 +21127,7 @@
"type": {
"type": "string",
"default": "newEvent",
"enum": ["newEvent"],
"description": "Trigger type for the workflow"
}
},
@@ -20918,6 +21139,7 @@
"type": {
"type": "string",
"default": "rescheduleEvent",
"enum": ["rescheduleEvent"],
"description": "Trigger type for the workflow"
}
},
@@ -20937,6 +21159,7 @@
"type": {
"type": "string",
"default": "afterGuestsCalVideoNoShow",
"enum": ["afterGuestsCalVideoNoShow"],
"description": "Trigger type for the workflow",
"example": "afterGuestsCalVideoNoShow"
}
@@ -20957,6 +21180,7 @@
"type": {
"type": "string",
"default": "afterHostsCalVideoNoShow",
"enum": ["afterHostsCalVideoNoShow"],
"description": "Trigger type for the workflow",
"example": "afterHostsCalVideoNoShow"
}
@@ -21428,6 +21652,17 @@
"properties": {
"type": {
"type": "object",
"enum": [
[
"beforeEvent",
"eventCancelled",
"newEvent",
"afterEvent",
"rescheduleEvent",
"afterHostsCalVideoNoShow",
"afterGuestsCalVideoNoShow"
]
],
"description": "Trigger type for the workflow"
}
},