feat: v2 teams CRUD (#18019)

* feat: teams endpoints

* refactor: organization teams reuse team types

* refactor: move team specific functions out of organizations-teams.repository

* supporting files

* regenerate docs

* feat: stripe service to generate team creation checkout

* refactor: request payment when creating a team

* fix: tests

* fix env

* driveby: event type name and email booking fields

* finish merge main
This commit is contained in:
Lauris Skraucis
2024-12-17 14:19:57 +00:00
committed by GitHub
parent b0094bad2d
commit a0f986f949
38 changed files with 2081 additions and 446 deletions
+426
View File
@@ -5130,6 +5130,147 @@
"tags": ["Stripe"]
}
},
"/v2/teams": {
"post": {
"operationId": "TeamsController_createTeam",
"summary": "Create a team",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTeamInput"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTeamOutput"
}
}
}
}
},
"tags": ["Teams"]
},
"get": {
"operationId": "TeamsController_getTeams",
"summary": "Get teams",
"parameters": [],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetTeamsOutput"
}
}
}
}
},
"tags": ["Teams"]
}
},
"/v2/teams/{teamId}": {
"get": {
"operationId": "TeamsController_getTeam",
"summary": "Get a team",
"parameters": [
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetTeamOutput"
}
}
}
}
},
"tags": ["Teams"]
},
"patch": {
"operationId": "TeamsController_updateTeam",
"summary": "Update a team",
"parameters": [
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateOrgTeamDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateTeamOutput"
}
}
}
}
},
"tags": ["Teams"]
},
"delete": {
"operationId": "TeamsController_deleteTeam",
"summary": "Delete a team",
"parameters": [
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrgTeamOutputResponseDto"
}
}
}
}
},
"tags": ["Teams"]
}
},
"/v2/teams/{teamId}/memberships": {
"post": {
"operationId": "TeamsMembershipsController_createTeamMembership",
@@ -6728,6 +6869,48 @@
},
"required": ["type"]
},
"NameFieldInput_2024_06_14": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "name",
"description": "only allowed value for type is `name`"
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&name=bob`, the name field will be prefilled with this value and disabled."
}
},
"required": ["type", "label", "placeholder"]
},
"EmailFieldInput_2024_06_14": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "email",
"description": "only allowed value for type is `email`"
},
"label": {
"type": "string"
},
"placeholder": {
"type": "string"
},
"disableOnPrefill": {
"type": "boolean",
"description": "Disable this booking field if the URL contains query parameter with key equal to the slug and prefill it with the provided value. For example, if URL contains query parameter `&email=bob@gmail.com`, the email field will be prefilled with this value and disabled."
}
},
"required": ["type", "label", "placeholder"]
},
"BookerLayouts_2024_06_14": {
"type": "object",
"properties": {
@@ -6836,6 +7019,12 @@
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/NameFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/EmailFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/PhoneFieldInput_2024_06_14"
},
@@ -8393,6 +8582,12 @@
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/NameFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/EmailFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/PhoneFieldInput_2024_06_14"
},
@@ -9730,6 +9925,12 @@
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/NameFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/EmailFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/PhoneFieldInput_2024_06_14"
},
@@ -10483,6 +10684,12 @@
"description": "Custom fields that can be added to the booking form when the event is booked by someone. By default booking form has name and email field.",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/NameFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/EmailFieldInput_2024_06_14"
},
{
"$ref": "#/components/schemas/PhoneFieldInput_2024_06_14"
},
@@ -11421,6 +11628,225 @@
},
"required": ["status", "data"]
},
"CreateTeamInput": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"description": "Name of the team",
"example": "CalTeam"
},
"slug": {
"type": "string",
"description": "Team slug",
"example": "caltel"
},
"logoUrl": {
"type": "string",
"example": "https://i.cal.com/api/avatar/b0b58752-68ad-4c0d-8024-4fa382a77752.png",
"description": "URL of the teams logo image"
},
"calVideoLogo": {
"type": "string"
},
"appLogo": {
"type": "string"
},
"appIconLogo": {
"type": "string"
},
"bio": {
"type": "string"
},
"hideBranding": {
"type": "boolean",
"default": false
},
"isPrivate": {
"type": "boolean"
},
"hideBookATeamMember": {
"type": "boolean"
},
"metadata": {
"type": "string"
},
"theme": {
"type": "string"
},
"brandColor": {
"type": "string"
},
"darkBrandColor": {
"type": "string"
},
"bannerUrl": {
"type": "string",
"example": "https://i.cal.com/api/avatar/949be534-7a88-4185-967c-c020b0c0bef3.png",
"description": "URL of the teams banner image which is shown on booker"
},
"timeFormat": {
"type": "number"
},
"timeZone": {
"type": "string",
"default": "Europe/London",
"example": "America/New_York",
"description": "Timezone is used to create teams's default schedule from Monday to Friday from 9AM to 5PM. It will default to Europe/London if not passed."
},
"weekStart": {
"type": "string",
"default": "Sunday",
"example": "Monday"
},
"autoAcceptCreator": {
"type": "boolean",
"default": true
}
},
"required": ["name"]
},
"CreateTeamOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/Output"
},
{
"$ref": "#/components/schemas/TeamOutputDto"
}
],
"description": "Either an Output object or a TeamOutputDto."
}
},
"required": ["status", "data"]
},
"TeamOutputDto": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"parentId": {
"type": "number"
},
"name": {
"type": "string",
"minLength": 1
},
"slug": {
"type": "string"
},
"logoUrl": {
"type": "string"
},
"calVideoLogo": {
"type": "string"
},
"appLogo": {
"type": "string"
},
"appIconLogo": {
"type": "string"
},
"bio": {
"type": "string"
},
"hideBranding": {
"type": "boolean"
},
"isOrganization": {
"type": "boolean"
},
"isPrivate": {
"type": "boolean"
},
"hideBookATeamMember": {
"type": "boolean",
"default": false
},
"metadata": {
"type": "string"
},
"theme": {
"type": "string"
},
"brandColor": {
"type": "string"
},
"darkBrandColor": {
"type": "string"
},
"bannerUrl": {
"type": "string"
},
"timeFormat": {
"type": "number"
},
"timeZone": {
"type": "string",
"default": "Europe/London"
},
"weekStart": {
"type": "string",
"default": "Sunday"
}
},
"required": ["id", "name", "isOrganization"]
},
"GetTeamOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"$ref": "#/components/schemas/TeamOutputDto"
}
},
"required": ["status", "data"]
},
"GetTeamsOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TeamOutputDto"
}
}
},
"required": ["status", "data"]
},
"UpdateTeamOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"$ref": "#/components/schemas/TeamOutputDto"
}
},
"required": ["status", "data"]
},
"AuthUrlData": {
"type": "object",
"properties": {