Scheduling infrastructure for absolutely everyone.
feat: attributes v2 api (#16461)
sean-brydon2de33fe1bf32
diff --git a/apps/api/v2/package.json b/apps/api/v2/package.jsonindex 7971b4ebaba..10f4c71ecca 100644--- a/apps/api/v2/package.json+++ b/apps/api/v2/package.json@@ -12,6 +12,7 @@"dev:build:watch": "yarn workspace @calcom/platform-constants build:watch & yarn workspace @calcom/platform-utils build:watch & yarn workspace @calcom/platform-types build:watch","dev:build": "yarn workspace @calcom/platform-constants build && yarn workspace @calcom/platform-enums build && yarn workspace @calcom/platform-utils build && yarn workspace @calcom/platform-types build ","dev": "yarn dev:build && docker-compose up -d && yarn copy-swagger-module && yarn start --watch",+ "dev:no-docker": "yarn dev:build && yarn copy-swagger-module && yarn start --watch","start:debug": "nest start --debug --watch","start:prod": "node ./dist/apps/api/v2/src/main.js","test": "yarn dev:build && jest",@@ -19,6 +20,7 @@"test:cov": "yarn dev:build && jest --coverage","test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:e2e": "yarn dev:build && jest --runInBand --detectOpenHandles --forceExit --config ./jest-e2e.json",+ "test:e2e:watch": "yarn dev:build && jest --runInBand --detectOpenHandles --forceExit --config ./jest-e2e.json --watch","prisma": "yarn workspace @calcom/prisma prisma","generate-schemas": "yarn prisma generate && yarn prisma format","copy-swagger-module": "ts-node -r tsconfig-paths/register swagger/copy-swagger-module.ts"diff --git a/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes-options.e2e-spec.ts b/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes-options.e2e-spec.tsnew file mode 100644index 00000000000..c291190ef98--- /dev/null+++ b/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes-options.e2e-spec.ts@@ -0,0 +1,250 @@+import { bootstrap } from "@/app";+import { AppModule } from "@/app.module";+import { AssignOrganizationAttributeOptionToUserInput } from "@/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input";+import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";+import { UpdateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts";+import { PrismaModule } from "@/modules/prisma/prisma.module";+import { TokensModule } from "@/modules/tokens/tokens.module";+import { UsersModule } from "@/modules/users/users.module";+import { INestApplication } from "@nestjs/common";+import { NestExpressApplication } from "@nestjs/platform-express";+import { Test } from "@nestjs/testing";+import * as request from "supertest";+import { AttributeRepositoryFixture } from "test/fixtures/repository/attributes.repository.fixture";+import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";+import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";+import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";+import { withApiAuth } from "test/utils/withApiAuth";++import { SUCCESS_STATUS } from "@calcom/platform-constants";+import { User, Team, Membership } from "@calcom/prisma/client";++describe("Organizations Attributes Options Endpoints", () => {+ describe("User lacks required role", () => {+ let app: INestApplication;+ let userRepositoryFixture: UserRepositoryFixture;+ let organizationsRepositoryFixture: OrganizationRepositoryFixture;+ let membershipFixtures: MembershipRepositoryFixture;++ const userEmail = "[email protected]";+ let user: User;+ let org: Team;+ let membership: Membership;+ let attributeId: string;++ beforeAll(async () => {+ const moduleRef = await withApiAuth(+ userEmail,+ Test.createTestingModule({+ imports: [AppModule, PrismaModule, UsersModule, TokensModule],+ })+ ).compile();++ userRepositoryFixture = new UserRepositoryFixture(moduleRef);+ organizationsRepositoryFixture = new OrganizationRepositoryFixture(moduleRef);+ membershipFixtures = new MembershipRepositoryFixture(moduleRef);++ org = await organizationsRepositoryFixture.create({+ name: "AttributesOptionsCorp",+ isOrganization: true,+ });++ user = await userRepositoryFixture.create({+ email: userEmail,+ username: userEmail,+ organization: { connect: { id: org.id } },+ });++ membership = await membershipFixtures.addUserToOrg(user, org, "MEMBER", true);++ // Create an attribute for testing+ attributeId = "test-attribute-id";++ app = moduleRef.createNestApplication();+ bootstrap(app as NestExpressApplication);++ await app.init();+ });++ it("should not be able to create attribute option", async () => {+ return request(app.getHttpServer())+ .post(`/v2/organizations/${org.id}/attributes/${attributeId}/options`)+ .send({+ name: "Option 1",+ value: "option1",+ })+ .expect(403);+ });++ it("should not be able to delete attribute option", async () => {+ return request(app.getHttpServer())+ .delete(`/v2/organizations/${org.id}/attributes/${attributeId}/options/1`)+ .expect(403);+ });++ afterAll(async () => {+ await membershipFixtures.delete(membership.id);+ await userRepositoryFixture.deleteByEmail(user.email);+ await organizationsRepositoryFixture.delete(org.id);+ await app.close();+ });+ });++ describe("User has required role", () => {+ let app: INestApplication;+ let userRepositoryFixture: UserRepositoryFixture;+ let organizationsRepositoryFixture: OrganizationRepositoryFixture;+ let membershipFixtures: MembershipRepositoryFixture;+ let attributeRepositoryFixture: AttributeRepositoryFixture;++ const userEmail = "[email protected]";+ let user: User;+ let org: Team;+ let membership: Membership;+ let attributeId: string;+ let createdOption: any;++ const createOptionInput: CreateOrganizationAttributeOptionInput = {+ value: "option1",+ slug: "option1",+ };++ beforeAll(async () => {+ const moduleRef = await withApiAuth(+ userEmail,+ Test.createTestingModule({+ imports: [AppModule, PrismaModule, UsersModule, TokensModule],+ })+ ).compile();++ userRepositoryFixture = new UserRepositoryFixture(moduleRef);+ organizationsRepositoryFixture = new OrganizationRepositoryFixture(moduleRef);+ membershipFixtures = new MembershipRepositoryFixture(moduleRef);+ attributeRepositoryFixture = new AttributeRepositoryFixture(moduleRef);++ org = await organizationsRepositoryFixture.create({+ name: "AttributesOptionsCorp",+ isOrganization: true,+ });++ user = await userRepositoryFixture.create({+ email: userEmail,+ username: userEmail,+ organization: { connect: { id: org.id } },+ });++ membership = await membershipFixtures.addUserToOrg(user, org, "ADMIN", true);++ // Create an attribute for testing+ const attribute = await attributeRepositoryFixture.create({+ name: "Test Attribute",+ team: { connect: { id: org.id } },+ type: "TEXT",+ slug: "test-attribute",+ });+ attributeId = attribute.id;++ app = moduleRef.createNestApplication();+ bootstrap(app as NestExpressApplication);++ await app.init();+ });++ it("should create attribute option", async () => {+ return request(app.getHttpServer())+ .post(`/v2/organizations/${org.id}/attributes/${attributeId}/options`)+ .send(createOptionInput)+ .expect(201)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ createdOption = response.body.data;+ expect(createdOption.value).toEqual(createOptionInput.value);+ expect(createdOption.slug).toEqual(createOptionInput.slug);+ });+ });++ it("should get attribute options", async () => {+ return request(app.getHttpServer())+ .get(`/v2/organizations/${org.id}/attributes/${attributeId}/options`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const options = response.body.data;+ expect(options.length).toEqual(1);+ expect(options[0].value).toEqual(createOptionInput.value);+ expect(options[0].slug).toEqual(createOptionInput.slug);+ });+ });++ it("should update attribute option", async () => {+ const updateOptionInput: UpdateOrganizationAttributeOptionInput = {+ value: "updated-option-value",+ };++ return request(app.getHttpServer())+ .patch(`/v2/organizations/${org.id}/attributes/${attributeId}/options/${createdOption.id}`)+ .send(updateOptionInput)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const updatedOption = response.body.data;+ expect(updatedOption.value).toEqual(updateOptionInput.value);+ });+ });++ it("should assign attribute option to user", async () => {+ const assignInput: AssignOrganizationAttributeOptionToUserInput = {+ attributeId: attributeId,+ attributeOptionId: createdOption.id,+ };++ return request(app.getHttpServer())+ .post(`/v2/organizations/${org.id}/attributes/options/${user.id}`)+ .send(assignInput)+ .expect(201)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ expect(response.body.data).toBeTruthy();+ });+ });++ it("should get attribute options for user", async () => {+ return request(app.getHttpServer())+ .get(`/v2/organizations/${org.id}/attributes/options/${user.id}`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const userOptions = response.body.data;+ expect(userOptions.length).toEqual(1);+ expect(userOptions[0].id).toEqual(createdOption.id);+ });+ });++ it("should unassign attribute option from user", async () => {+ return request(app.getHttpServer())+ .delete(`/v2/organizations/${org.id}/attributes/options/${user.id}/${createdOption.id}`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ expect(response.body.data).toBeTruthy();+ });+ });++ it("should delete attribute option", async () => {+ return request(app.getHttpServer())+ .delete(`/v2/organizations/${org.id}/attributes/${attributeId}/options/${createdOption.id}`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ expect(response.body.data).toBeTruthy();+ });+ });++ afterAll(async () => {+ await membershipFixtures.delete(membership.id);+ await userRepositoryFixture.deleteByEmail(user.email);+ await organizationsRepositoryFixture.delete(org.id);+ await app.close();+ });+ });+});diff --git a/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes.e2e-spec.ts b/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes.e2e-spec.tsnew file mode 100644index 00000000000..1365670a197--- /dev/null+++ b/apps/api/v2/src/modules/organizations/controllers/attributes/organization-attributes.e2e-spec.ts@@ -0,0 +1,213 @@+import { bootstrap } from "@/app";+import { AppModule } from "@/app.module";+import { CreateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/create-organization-attribute.input";+import { UpdateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/update-organization-attribute.input";+import { PrismaModule } from "@/modules/prisma/prisma.module";+import { TokensModule } from "@/modules/tokens/tokens.module";+import { UsersModule } from "@/modules/users/users.module";+import { INestApplication } from "@nestjs/common";+import { NestExpressApplication } from "@nestjs/platform-express";+import { Test } from "@nestjs/testing";+import * as request from "supertest";+import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";+import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";+import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";+import { withApiAuth } from "test/utils/withApiAuth";++import { SUCCESS_STATUS } from "@calcom/platform-constants";+import { User, Team, Membership } from "@calcom/prisma/client";++describe("Organizations Attributes Endpoints", () => {+ describe("User lacks required role", () => {+ let app: INestApplication;+ let userRepositoryFixture: UserRepositoryFixture;+ let organizationsRepositoryFixture: OrganizationRepositoryFixture;+ let membershipFixtures: MembershipRepositoryFixture;++ const userEmail = "[email protected]";+ let user: User;+ let org: Team;+ let membership: Membership;++ beforeAll(async () => {+ const moduleRef = await withApiAuth(+ userEmail,+ Test.createTestingModule({+ imports: [AppModule, PrismaModule, UsersModule, TokensModule],+ })+ ).compile();++ userRepositoryFixture = new UserRepositoryFixture(moduleRef);+ organizationsRepositoryFixture = new OrganizationRepositoryFixture(moduleRef);+ membershipFixtures = new MembershipRepositoryFixture(moduleRef);++ org = await organizationsRepositoryFixture.create({+ name: "AttributesCorp",+ isOrganization: true,+ });++ user = await userRepositoryFixture.create({+ email: userEmail,+ username: userEmail,+ organization: { connect: { id: org.id } },+ });++ membership = await membershipFixtures.addUserToOrg(user, org, "MEMBER", true);++ app = moduleRef.createNestApplication();+ bootstrap(app as NestExpressApplication);++ await app.init();+ });++ it("should not be able to create attribute for org", async () => {+ return request(app.getHttpServer())+ .post(`/v2/organizations/${org.id}/attributes`)+ .send({+ key: "department",+ value: "engineering",+ })+ .expect(403);+ });++ it("should not be able to delete attribute for org", async () => {+ return request(app.getHttpServer()).delete(`/v2/organizations/${org.id}/attributes/1`).expect(403);+ });++ afterAll(async () => {+ await membershipFixtures.delete(membership.id);+ await userRepositoryFixture.deleteByEmail(user.email);+ await organizationsRepositoryFixture.delete(org.id);+ await app.close();+ });+ });++ describe("User has required role", () => {+ let app: INestApplication;+ let userRepositoryFixture: UserRepositoryFixture;+ let organizationsRepositoryFixture: OrganizationRepositoryFixture;+ let membershipFixtures: MembershipRepositoryFixture;++ const userEmail = "[email protected]";+ let user: User;+ let org: Team;+ let membership: Membership;++ let createdAttribute: any;++ const createAttributeInput: CreateOrganizationAttributeInput = {+ name: "department",+ slug: "department",+ type: "TEXT",+ options: [],+ enabled: true,+ };++ beforeAll(async () => {+ const moduleRef = await withApiAuth(+ userEmail,+ Test.createTestingModule({+ imports: [AppModule, PrismaModule, UsersModule, TokensModule],+ })+ ).compile();++ userRepositoryFixture = new UserRepositoryFixture(moduleRef);+ organizationsRepositoryFixture = new OrganizationRepositoryFixture(moduleRef);+ membershipFixtures = new MembershipRepositoryFixture(moduleRef);++ org = await organizationsRepositoryFixture.create({+ name: "AttributesCorp",+ isOrganization: true,+ });++ user = await userRepositoryFixture.create({+ email: userEmail,+ username: userEmail,+ organization: { connect: { id: org.id } },+ });++ membership = await membershipFixtures.addUserToOrg(user, org, "ADMIN", true);++ app = moduleRef.createNestApplication();+ bootstrap(app as NestExpressApplication);++ await app.init();+ });++ it("should create attribute for org", async () => {+ return request(app.getHttpServer())+ .post(`/v2/organizations/${org.id}/attributes`)+ .send(createAttributeInput)+ .expect(201)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ createdAttribute = response.body.data;+ expect(createdAttribute.type).toEqual(createAttributeInput.type);+ expect(createdAttribute.slug).toEqual(createAttributeInput.slug);+ expect(createdAttribute.enabled).toEqual(createAttributeInput.enabled);+ });+ });++ it("should get org attributes", async () => {+ return request(app.getHttpServer())+ .get(`/v2/organizations/${org.id}/attributes`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const attributes = response.body.data;+ expect(attributes.length).toEqual(1);+ expect(attributes[0].name).toEqual(createAttributeInput.name);+ expect(attributes[0].slug).toEqual(createAttributeInput.slug);+ expect(attributes[0].type).toEqual(createAttributeInput.type);+ expect(attributes[0].enabled).toEqual(createAttributeInput.enabled);+ });+ });++ it("should get single org attribute", async () => {+ return request(app.getHttpServer())+ .get(`/v2/organizations/${org.id}/attributes/${createdAttribute.id}`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const attribute = response.body.data;+ expect(attribute.name).toEqual(createAttributeInput.name);+ expect(attribute.slug).toEqual(createAttributeInput.slug);+ expect(attribute.type).toEqual(createAttributeInput.type);+ expect(attribute.enabled).toEqual(createAttributeInput.enabled);+ });+ });++ it("should update org attribute", async () => {+ const updateAttributeInput: UpdateOrganizationAttributeInput = {+ name: "marketing",+ };++ return request(app.getHttpServer())+ .patch(`/v2/organizations/${org.id}/attributes/${createdAttribute.id}`)+ .send(updateAttributeInput)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ const updatedAttribute = response.body.data;+ expect(updatedAttribute.name).toEqual(updateAttributeInput.name);+ });+ });++ it("should delete org attribute", async () => {+ return request(app.getHttpServer())+ .delete(`/v2/organizations/${org.id}/attributes/${createdAttribute.id}`)+ .expect(200)+ .then((response) => {+ expect(response.body.status).toEqual(SUCCESS_STATUS);+ expect(response.body.data).toBeTruthy();+ });+ });++ afterAll(async () => {+ await membershipFixtures.delete(membership.id);+ await userRepositoryFixture.deleteByEmail(user.email);+ await organizationsRepositoryFixture.delete(org.id);+ await app.close();+ });+ });+});diff --git a/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes-options.controller.ts b/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes-options.controller.tsnew file mode 100644index 00000000000..44c03782230--- /dev/null+++ b/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes-options.controller.ts@@ -0,0 +1,173 @@+import { API_VERSIONS_VALUES } from "@/lib/api-versions";+import { PlatformPlan } from "@/modules/auth/decorators/billing/platform-plan.decorator";+import { Roles } from "@/modules/auth/decorators/roles/roles.decorator";+import { ApiAuthGuard } from "@/modules/auth/guards/api-auth/api-auth.guard";+import { PlatformPlanGuard } from "@/modules/auth/guards/billing/platform-plan.guard";+import { IsAdminAPIEnabledGuard } from "@/modules/auth/guards/organizations/is-admin-api-enabled.guard";+import { IsOrgGuard } from "@/modules/auth/guards/organizations/is-org.guard";+import { RolesGuard } from "@/modules/auth/guards/roles/roles.guard";+import { AssignOrganizationAttributeOptionToUserInput } from "@/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input";+import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";+import { UpdateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts";+import {+ AssignOptionUserOutput,+ UnassignOptionUserOutput,+} from "@/modules/organizations/outputs/attributes/options/assign-option-user.output";+import { CreateAttributeOptionOutput } from "@/modules/organizations/outputs/attributes/options/create-option.output";+import { DeleteAttributeOptionOutput } from "@/modules/organizations/outputs/attributes/options/delete-option.output";+import { GetOptionUserOutput } from "@/modules/organizations/outputs/attributes/options/get-option-user.output";+import { GetAllAttributeOptionOutput } from "@/modules/organizations/outputs/attributes/options/get-option.output";+import { UpdateAttributeOptionOutput } from "@/modules/organizations/outputs/attributes/options/update-option.output";+import { OrganizationAttributeOptionService } from "@/modules/organizations/services/attributes/organization-attributes-option.service";+import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, UseGuards } from "@nestjs/common";++import { SUCCESS_STATUS } from "@calcom/platform-constants";++@Controller({+ path: "/v2/organizations/:orgId",+ version: API_VERSIONS_VALUES,+})+@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)+export class OrganizationsOptionsAttributesController {+ constructor(private readonly organizationsAttributesOptionsService: OrganizationAttributeOptionService) {}++ // Creates an attribute option for an attribute+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Post("/attributes/:attributeId/options")+ async createOrganizationAttributeOption(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string,+ @Body() bodyAttribute: CreateOrganizationAttributeOptionInput+ ): Promise<CreateAttributeOptionOutput> {+ const attributeOption =+ await this.organizationsAttributesOptionsService.createOrganizationAttributeOption(+ orgId,+ attributeId,+ bodyAttribute+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOption,+ };+ }++ // Deletes an attribute option for an attribute+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Delete("/attributes/:attributeId/options/:optionId")+ async deleteOrganizationAttributeOption(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string,+ @Param("optionId") optionId: string+ ): Promise<DeleteAttributeOptionOutput> {+ const attributeOption =+ await this.organizationsAttributesOptionsService.deleteOrganizationAttributeOption(+ orgId,+ attributeId,+ optionId+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOption,+ };+ }++ // Updates an attribute option for an attribute+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Patch("/attributes/:attributeId/options/:optionId")+ async updateOrganizationAttributeOption(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string,+ @Param("optionId") optionId: string,+ @Body() bodyAttribute: UpdateOrganizationAttributeOptionInput+ ): Promise<UpdateAttributeOptionOutput> {+ const attributeOption =+ await this.organizationsAttributesOptionsService.updateOrganizationAttributeOption(+ orgId,+ attributeId,+ optionId,+ bodyAttribute+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOption,+ };+ }++ // Gets all attribute options for an attribute+ @Roles("ORG_MEMBER")+ @PlatformPlan("ESSENTIALS")+ @Get("/attributes/:attributeId/options")+ async getOrganizationAttributeOptions(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string+ ): Promise<GetAllAttributeOptionOutput> {+ const attributeOptions = await this.organizationsAttributesOptionsService.getOrganizationAttributeOptions(+ orgId,+ attributeId+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOptions,+ };+ }++ // Assign attribute option to user+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Post("/attributes/options/:userId")+ async assignOrganizationAttributeOptionToUser(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("userId", ParseIntPipe) userId: number,+ @Body() bodyAttribute: AssignOrganizationAttributeOptionToUserInput+ ): Promise<AssignOptionUserOutput> {+ const attributeOption =+ await this.organizationsAttributesOptionsService.assignOrganizationAttributeOptionToUser(+ orgId,+ userId,+ bodyAttribute+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOption,+ };+ }++ // Unassign attribute option from user+ @Roles("ORG_MEMBER")+ @PlatformPlan("ESSENTIALS")+ @Delete("/attributes/options/:userId/:attributeOptionId")+ async unassignOrganizationAttributeOptionFromUser(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("userId", ParseIntPipe) userId: number,+ @Param("attributeOptionId") attributeOptionId: string+ ): Promise<UnassignOptionUserOutput> {+ const attributeOption =+ await this.organizationsAttributesOptionsService.unassignOrganizationAttributeOptionFromUser(+ orgId,+ userId,+ attributeOptionId+ );+ return {+ status: SUCCESS_STATUS,+ data: attributeOption,+ };+ }++ @Roles("ORG_MEMBER")+ @PlatformPlan("ESSENTIALS")+ @Get("/attributes/options/:userId")+ async getOrganizationAttributeOptionsForUser(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("userId", ParseIntPipe) userId: number+ ): Promise<GetOptionUserOutput> {+ const attributeOptions =+ await this.organizationsAttributesOptionsService.getOrganizationAttributeOptionsForUser(orgId, userId);+ return {+ status: SUCCESS_STATUS,+ data: attributeOptions,+ };+ }+}diff --git a/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes.controller.ts b/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes.controller.tsnew file mode 100644index 00000000000..0464c6443b3--- /dev/null+++ b/apps/api/v2/src/modules/organizations/controllers/attributes/organizations-attributes.controller.ts@@ -0,0 +1,129 @@+import { API_VERSIONS_VALUES } from "@/lib/api-versions";+import { PlatformPlan } from "@/modules/auth/decorators/billing/platform-plan.decorator";+import { Roles } from "@/modules/auth/decorators/roles/roles.decorator";+import { ApiAuthGuard } from "@/modules/auth/guards/api-auth/api-auth.guard";+import { PlatformPlanGuard } from "@/modules/auth/guards/billing/platform-plan.guard";+import { IsAdminAPIEnabledGuard } from "@/modules/auth/guards/organizations/is-admin-api-enabled.guard";+import { IsOrgGuard } from "@/modules/auth/guards/organizations/is-org.guard";+import { RolesGuard } from "@/modules/auth/guards/roles/roles.guard";+import { CreateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/create-organization-attribute.input";+import { UpdateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/update-organization-attribute.input";+import { CreateOrganizationAttributesOutput } from "@/modules/organizations/outputs/attributes/create-organization-attributes.output";+import { DeleteOrganizationAttributesOutput } from "@/modules/organizations/outputs/attributes/delete-organization-attributes.output";+import {+ GetOrganizationAttributesOutput,+ GetSingleAttributeOutput,+} from "@/modules/organizations/outputs/attributes/get-organization-attributes.output";+import { UpdateOrganizationAttributesOutput } from "@/modules/organizations/outputs/attributes/update-organization-attributes.output";+import { OrganizationAttributesService } from "@/modules/organizations/services/attributes/organization-attributes.service";+import {+ Body,+ Controller,+ Delete,+ Get,+ Param,+ ParseIntPipe,+ Patch,+ Post,+ Query,+ UseGuards,+} from "@nestjs/common";++import { SUCCESS_STATUS } from "@calcom/platform-constants";+import { SkipTakePagination } from "@calcom/platform-types";++@Controller({+ path: "/v2/organizations/:orgId",+ version: API_VERSIONS_VALUES,+})+@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)+export class OrganizationsAttributesController {+ constructor(private readonly organizationsAttributesService: OrganizationAttributesService) {}+ // Gets all attributes for an organization+ @Roles("ORG_MEMBER")+ @PlatformPlan("ESSENTIALS")+ @Get("/attributes")+ async getOrganizationAttributes(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Query() queryParams: SkipTakePagination+ ): Promise<GetOrganizationAttributesOutput> {+ const { skip, take } = queryParams;+ const attributes = await this.organizationsAttributesService.getOrganizationAttributes(orgId, skip, take);++ return {+ status: SUCCESS_STATUS,+ data: attributes,+ };+ }++ // Gets a single attribute for an organization+ @Roles("ORG_MEMBER")+ @PlatformPlan("ESSENTIALS")+ @Get("/attributes/:attributeId")+ async getOrganizationAttribute(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string+ ): Promise<GetSingleAttributeOutput> {+ const attribute = await this.organizationsAttributesService.getOrganizationAttribute(orgId, attributeId);+ return {+ status: SUCCESS_STATUS,+ data: attribute,+ };+ }++ // Creates an attribute for an organization+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Post("/attributes")+ async createOrganizationAttribute(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Body() bodyAttribute: CreateOrganizationAttributeInput+ ): Promise<CreateOrganizationAttributesOutput> {+ const attribute = await this.organizationsAttributesService.createOrganizationAttribute(+ orgId,+ bodyAttribute+ );+ return {+ status: SUCCESS_STATUS,+ data: attribute,+ };+ }++ // Updates an attribute for an organization+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Patch("/attributes/:attributeId")+ async updateOrganizationAttribute(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string,+ @Body() bodyAttribute: UpdateOrganizationAttributeInput+ ): Promise<UpdateOrganizationAttributesOutput> {+ const attribute = await this.organizationsAttributesService.updateOrganizationAttribute(+ orgId,+ attributeId,+ bodyAttribute+ );+ return {+ status: SUCCESS_STATUS,+ data: attribute,+ };+ }++ // Deletes an attribute for an organization+ @Roles("ORG_ADMIN")+ @PlatformPlan("ESSENTIALS")+ @Delete("/attributes/:attributeId")+ async deleteOrganizationAttribute(+ @Param("orgId", ParseIntPipe) orgId: number,+ @Param("attributeId") attributeId: string+ ): Promise<DeleteOrganizationAttributesOutput> {+ const attribute = await this.organizationsAttributesService.deleteOrganizationAttribute(+ orgId,+ attributeId+ );+ return {+ status: SUCCESS_STATUS,+ data: attribute,+ };+ }+}diff --git a/apps/api/v2/src/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input.ts b/apps/api/v2/src/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input.tsnew file mode 100644index 00000000000..6654e4eb699--- /dev/null+++ b/apps/api/v2/src/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input.ts@@ -0,0 +1,17 @@+import { IsNotEmpty, IsOptional, IsString } from "class-validator";++export class AssignOrganizationAttributeOptionToUserInput {+ @IsOptional()+ @IsString()+ @IsNotEmpty()+ readonly value?: string;++ @IsOptional()+ @IsString()+ @IsNotEmpty()+ readonly attributeOptionId?: string;++ @IsNotEmpty()+ @IsString()+ readonly attributeId!: string;+}diff --git a/apps/api/v2/src/modules/organizations/inputs/attributes/create-organization-attribute.input.ts b/apps/api/v2/src/modules/organizations/inputs/attributes/create-organization-attribute.input.tsnew file mode 100644index 00000000000..3d5abd78822--- /dev/null+++ b/apps/api/v2/src/modules/organizations/inputs/attributes/create-organization-attribute.input.ts@@ -0,0 +1,35 @@+import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";+import { AttributeType } from "@prisma/client";+import { Type } from "class-transformer";+import {+ IsArray,+ IsBoolean,+ IsEnum,+ IsNotEmpty,+ IsOptional,+ IsString,+ ValidateNested,+} from "class-validator";++export class CreateOrganizationAttributeInput {+ @IsString()+ @IsNotEmpty()+ readonly name!: string;++ @IsString()+ @IsNotEmpty()+ readonly slug!: string;++ @IsEnum(AttributeType)+ @IsNotEmpty()+ readonly type!: AttributeType;++ @IsArray()+ @ValidateNested()+ @Type(() => CreateOrganizationAttributeOptionInput)+ readonly options!: CreateOrganizationAttributeOptionInput[];++ @IsBoolean()+ @IsOptional()+ readonly enabled?: boolean;+}diff --git a/apps/api/v2/src/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input.ts b/apps/api/v2/src/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input.tsnew file mode 100644index 00000000000..c2554955868--- /dev/null+++ b/apps/api/v2/src/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input.ts@@ -0,0 +1,11 @@+import { IsNotEmpty, IsString } from "class-validator";++export class CreateOrganizationAttributeOptionInput {+ @IsString()+ @IsNotEmpty()+ readonly value!: string;++ @IsString()+ @IsNotEmpty()+ readonly slug!: string;+}\ No newline at end of filediff --git a/apps/api/v2/src/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts.ts b/apps/api/v2/src/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts.tsnew file mode 100644index 00000000000..4fdc26abaea--- /dev/null+++ b/apps/api/v2/src/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts.ts@@ -0,0 +1,11 @@+import { IsNotEmpty, IsOptional, IsString } from "class-validator";++export class UpdateOrganizationAttributeOptionInput {+ @IsString()+ @IsOptional()+ readonly value?: string;++ @IsString()+ @IsOptional()+ readonly slug?: string;+}diff --git a/apps/api/v2/src/modules/organizations/inputs/attributes/update-organization-attribute.input.ts b/apps/api/v2/src/modules/organizations/inputs/attributes/update-organization-attribute.input.tsnew file mode 100644index 00000000000..e68f9dc4331--- /dev/null+++ b/apps/api/v2/src/modules/organizations/inputs/attributes/update-organization-attribute.input.ts@@ -0,0 +1,20 @@+import { AttributeType } from "@prisma/client";+import { IsBoolean, IsEnum, IsOptional, IsString } from "class-validator";++export class UpdateOrganizationAttributeInput {+ @IsString()+ @IsOptional()+ readonly name?: string;++ @IsString()+ @IsOptional()+ readonly slug?: string;++ @IsEnum(AttributeType)+ @IsOptional()+ readonly type?: AttributeType;++ @IsBoolean()+ @IsOptional()+ readonly enabled?: boolean;+}diff --git a/apps/api/v2/src/modules/organizations/organizations.module.ts b/apps/api/v2/src/modules/organizations/organizations.module.tsindex 54155ba02e6..82e381396e9 100644--- a/apps/api/v2/src/modules/organizations/organizations.module.ts+++ b/apps/api/v2/src/modules/organizations/organizations.module.ts@@ -3,6 +3,8 @@ import { SchedulesModule_2024_06_11 } from "@/ee/schedules/schedules_2024_06_11/import { EmailModule } from "@/modules/email/email.module";import { EmailService } from "@/modules/email/email.service";import { MembershipsRepository } from "@/modules/memberships/memberships.repository";+import { OrganizationsOptionsAttributesController } from "@/modules/organizations/controllers/attributes/organizations-attributes-options.controller";+import { OrganizationsAttributesController } from "@/modules/organizations/controllers/attributes/organizations-attributes.controller";import { OrganizationsEventTypesController } from "@/modules/organizations/controllers/event-types/organizations-event-types.controller";import { OrganizationsMembershipsController } from "@/modules/organizations/controllers/memberships/organizations-membership.controller";import { OrganizationsSchedulesController } from "@/modules/organizations/controllers/schedules/organizations-schedules.controller";@@ -11,6 +13,8 @@ import { OrganizationsTeamsController } from "@/modules/organizations/controllerimport { OrganizationsUsersController } from "@/modules/organizations/controllers/users/organizations-users.controller";import { OrganizationsWebhooksController } from "@/modules/organizations/controllers/webhooks/organizations-webhooks.controller";import { OrganizationsRepository } from "@/modules/organizations/organizations.repository";+import { OrganizationAttributeOptionRepository } from "@/modules/organizations/repositories/attributes/organization-attribute-option.repository";+import { OrganizationAttributesRepository } from "@/modules/organizations/repositories/attributes/organization-attribute.repository";import { OrganizationsEventTypesRepository } from "@/modules/organizations/repositories/organizations-event-types.repository";import { OrganizationsMembershipRepository } from "@/modules/organizations/repositories/organizations-membership.repository";import { OrganizationSchedulesRepository } from "@/modules/organizations/repositories/organizations-schedules.repository";@@ -18,6 +22,8 @@ import { OrganizationsTeamsMembershipsRepository } from "@/modules/organizationsimport { OrganizationsTeamsRepository } from "@/modules/organizations/repositories/organizations-teams.repository";import { OrganizationsUsersRepository } from "@/modules/organizations/repositories/organizations-users.repository";import { OrganizationsWebhooksRepository } from "@/modules/organizations/repositories/organizations-webhooks.repository";+import { OrganizationAttributeOptionService } from "@/modules/organizations/services/attributes/organization-attributes-option.service";+import { OrganizationAttributesService } from "@/modules/organizations/services/attributes/organization-attributes.service";import { InputOrganizationsEventTypesService } from "@/modules/organizations/services/event-types/input.service";import { OrganizationsEventTypesService } from "@/modules/organizations/services/event-types/organizations-event-types.service";import { OutputOrganizationsEventTypesService } from "@/modules/organizations/services/event-types/output.service";@@ -65,6 +71,10 @@ import { Module } from "@nestjs/common";OrganizationsEventTypesRepository,OrganizationsTeamsMembershipsRepository,OrganizationsTeamsMembershipsService,+ OrganizationAttributesService,+ OrganizationAttributeOptionService,+ OrganizationAttributeOptionRepository,+ OrganizationAttributesRepository,OrganizationsWebhooksRepository,OrganizationsWebhooksService,WebhooksRepository,@@ -80,6 +90,10 @@ import { Module } from "@nestjs/common";OrganizationsMembershipService,OrganizationsTeamsMembershipsRepository,OrganizationsTeamsMembershipsService,+ OrganizationAttributesService,+ OrganizationAttributeOptionService,+ OrganizationAttributeOptionRepository,+ OrganizationAttributesRepository,OrganizationsWebhooksRepository,OrganizationsWebhooksService,WebhooksRepository,@@ -92,6 +106,8 @@ import { Module } from "@nestjs/common";OrganizationsMembershipsController,OrganizationsEventTypesController,OrganizationsTeamsMembershipsController,+ OrganizationsAttributesController,+ OrganizationsOptionsAttributesController,OrganizationsWebhooksController,],})diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/attribute.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/attribute.output.tsnew file mode 100644index 00000000000..bdf05d3f405--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/attribute.output.ts@@ -0,0 +1,71 @@+import { ApiProperty } from "@nestjs/swagger";+import { IsString, IsInt, IsEnum, IsBoolean } from "class-validator";++export const AttributeType = {+ TEXT: "TEXT",+ NUMBER: "NUMBER",+ SINGLE_SELECT: "SINGLE_SELECT",+ MULTI_SELECT: "MULTI_SELECT",+} as const;++export type AttributeType = (typeof AttributeType)[keyof typeof AttributeType];++export class Attribute {+ @IsString()+ @ApiProperty({ type: String, required: true, description: "The ID of the attribute", example: "attr_123" })+ id!: string;++ @IsInt()+ @ApiProperty({+ type: Number,+ required: true,+ description: "The team ID associated with the attribute",+ example: 1,+ })+ teamId!: number;++ @ApiProperty({+ type: String,+ required: true,+ description: "The type of the attribute",+ enum: AttributeType,+ })+ @IsEnum(AttributeType)+ type!: AttributeType;++ @IsString()+ @ApiProperty({+ type: String,+ required: true,+ description: "The name of the attribute",+ example: "Attribute Name",+ })+ name!: string;++ @IsString()+ @ApiProperty({+ type: String,+ required: true,+ description: "The slug of the attribute",+ example: "attribute-name",+ })+ slug!: string;++ @IsBoolean()+ @ApiProperty({+ type: Boolean,+ required: true,+ description: "Whether the attribute is enabled and displayed on their profile",+ example: true,+ })+ enabled!: boolean;++ @IsBoolean()+ @ApiProperty({+ type: Boolean,+ required: false,+ description: "Whether users can edit the relation",+ example: true,+ })+ usersCanEditRelation!: boolean;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/base.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/base.output.tsnew file mode 100644index 00000000000..21bf06f1b76--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/base.output.ts@@ -0,0 +1,11 @@+import { ApiProperty } from "@nestjs/swagger";+import { IsEnum } from "class-validator";++import { ERROR_STATUS } from "@calcom/platform-constants";+import { SUCCESS_STATUS } from "@calcom/platform-constants";++export class BaseOutputDTO {+ @ApiProperty({ example: SUCCESS_STATUS, enum: [SUCCESS_STATUS, ERROR_STATUS] })+ @IsEnum([SUCCESS_STATUS, ERROR_STATUS])+ status!: typeof SUCCESS_STATUS | typeof ERROR_STATUS;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/create-organization-attributes.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/create-organization-attributes.output.tsnew file mode 100644index 00000000000..aa2ff2f547f--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/create-organization-attributes.output.ts@@ -0,0 +1,11 @@+import { Attribute } from "@/modules/organizations/outputs/attributes/attribute.output";+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class CreateOrganizationAttributesOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => Attribute)+ data!: Attribute;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/delete-organization-attributes.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/delete-organization-attributes.output.tsnew file mode 100644index 00000000000..5aa36314c95--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/delete-organization-attributes.output.ts@@ -0,0 +1,11 @@+import { Attribute } from "@/modules/organizations/outputs/attributes/attribute.output";+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class DeleteOrganizationAttributesOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => Attribute)+ data!: Attribute;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/get-organization-attributes.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/get-organization-attributes.output.tsnew file mode 100644index 00000000000..a4104834ebb--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/get-organization-attributes.output.ts@@ -0,0 +1,22 @@+import { Attribute } from "@/modules/organizations/outputs/attributes/attribute.output";+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { ApiProperty } from "@nestjs/swagger";+import { Expose, Type } from "class-transformer";+import { IsBoolean, IsInt, IsString, IsEnum, ValidateNested, IsOptional } from "class-validator";++import { AttributeType } from "@calcom/prisma/client";++export class GetSingleAttributeOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @IsOptional()+ @Type(() => Attribute)+ data!: Attribute | null;+}++export class GetOrganizationAttributesOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => Attribute)+ data!: Attribute[];+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/assign-option-user.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/assign-option-user.output.tsnew file mode 100644index 00000000000..fdb8fae13d6--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/assign-option-user.output.ts@@ -0,0 +1,33 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { OptionOutput } from "@/modules/organizations/outputs/attributes/options/option.output";+import { ApiProperty } from "@nestjs/swagger";+import { Expose, Type } from "class-transformer";+import { IsString, ValidateNested } from "class-validator";++class AssignOptionUserOutputData {+ @IsString()+ @ApiProperty({ type: String, required: true, description: "The ID of the option assigned to the user" })+ id!: string;++ @IsString()+ @ApiProperty({ type: Number, required: true, description: "The ID form the org membership for the user" })+ memberId!: number;++ @IsString()+ @ApiProperty({ type: String, required: true, description: "The value of the option" })+ attributeOptionId!: string;+}++export class AssignOptionUserOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => AssignOptionUserOutputData)+ data!: AssignOptionUserOutputData;+}++export class UnassignOptionUserOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => AssignOptionUserOutputData)+ data!: AssignOptionUserOutputData;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/create-option.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/create-option.output.tsnew file mode 100644index 00000000000..81f83e67f12--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/create-option.output.ts@@ -0,0 +1,11 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { OptionOutput } from "@/modules/organizations/outputs/attributes/options/option.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class CreateAttributeOptionOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => OptionOutput)+ data!: OptionOutput;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/delete-option.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/delete-option.output.tsnew file mode 100644index 00000000000..6b6203e8b0b--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/delete-option.output.ts@@ -0,0 +1,11 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { OptionOutput } from "@/modules/organizations/outputs/attributes/options/option.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class DeleteAttributeOptionOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => OptionOutput)+ data!: OptionOutput;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option-user.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option-user.output.tsnew file mode 100644index 00000000000..6f29020fd31--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option-user.output.ts@@ -0,0 +1,29 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { ApiProperty } from "@nestjs/swagger";+import { Expose, Type } from "class-transformer";+import { IsString, ValidateNested } from "class-validator";++class GetOptionUserOutputData {+ @IsString()+ @ApiProperty({ type: String, required: true, description: "The ID of the option assigned to the user" })+ id!: string;++ @IsString()+ @ApiProperty({ type: String, required: true, description: "The ID of the attribute" })+ attributeId!: string;++ @IsString()+ @ApiProperty({ type: String, required: true, description: "The value of the option" })+ value!: string;++ @IsString()+ @ApiProperty({ type: String, required: true, description: "The slug of the option" })+ slug!: string;+}++export class GetOptionUserOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => GetOptionUserOutputData)+ data!: GetOptionUserOutputData[];+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option.output.tsnew file mode 100644index 00000000000..11b9cd50663--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/get-option.output.ts@@ -0,0 +1,11 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { OptionOutput } from "@/modules/organizations/outputs/attributes/options/option.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class GetAllAttributeOptionOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => OptionOutput)+ data!: OptionOutput[];+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/option.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/option.output.tsnew file mode 100644index 00000000000..f3c202fc0a9--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/option.output.ts@@ -0,0 +1,36 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { ApiProperty } from "@nestjs/swagger";+import { IsString, IsInt, IsEnum, IsBoolean } from "class-validator";++export class OptionOutput {+ @IsString()+ @ApiProperty({+ type: String,+ required: true,+ description: "The ID of the option",+ example: "attr_option_id",+ })+ id!: string;++ @IsString()+ @ApiProperty({ type: String, required: true, description: "The ID of the attribute", example: "attr_id" })+ attributeId!: string;++ @IsString()+ @ApiProperty({+ type: String,+ required: true,+ description: "The value of the option",+ example: "option_value",+ })+ value!: string;++ @IsString()+ @ApiProperty({+ type: String,+ required: true,+ description: "The slug of the option",+ example: "option-slug",+ })+ slug!: string;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/options/update-option.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/options/update-option.output.tsnew file mode 100644index 00000000000..14b85aa2de5--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/options/update-option.output.ts@@ -0,0 +1,11 @@+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { OptionOutput } from "@/modules/organizations/outputs/attributes/options/option.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class UpdateAttributeOptionOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => OptionOutput)+ data!: OptionOutput;+}diff --git a/apps/api/v2/src/modules/organizations/outputs/attributes/update-organization-attributes.output.ts b/apps/api/v2/src/modules/organizations/outputs/attributes/update-organization-attributes.output.tsnew file mode 100644index 00000000000..3aa5b2c9b45--- /dev/null+++ b/apps/api/v2/src/modules/organizations/outputs/attributes/update-organization-attributes.output.ts@@ -0,0 +1,11 @@+import { Attribute } from "@/modules/organizations/outputs/attributes/attribute.output";+import { BaseOutputDTO } from "@/modules/organizations/outputs/attributes/base.output";+import { Expose, Type } from "class-transformer";+import { ValidateNested } from "class-validator";++export class UpdateOrganizationAttributesOutput extends BaseOutputDTO {+ @Expose()+ @ValidateNested()+ @Type(() => Attribute)+ data!: Attribute;+}diff --git a/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute-option.repository.ts b/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute-option.repository.tsnew file mode 100644index 00000000000..150965bdf02--- /dev/null+++ b/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute-option.repository.ts@@ -0,0 +1,160 @@+import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";+import { UpdateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts";+import { OrganizationsMembershipService } from "@/modules/organizations/services/organizations-membership.service";+import { PrismaReadService } from "@/modules/prisma/prisma-read.service";+import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";+import { Injectable, Logger, NotFoundException } from "@nestjs/common";++import { slugify } from "@calcom/platform-libraries";++@Injectable()+export class OrganizationAttributeOptionRepository {+ private readonly logger = new Logger("OrganizationAttributeOptionRepository");+ constructor(+ private readonly dbRead: PrismaReadService,+ private readonly dbWrite: PrismaWriteService,+ private readonly organizationsMembershipsService: OrganizationsMembershipService+ ) {}++ async createOrganizationAttributeOption(+ organizationId: number,+ attributeId: string,+ data: CreateOrganizationAttributeOptionInput+ ) {+ return this.dbWrite.prisma.attributeOption.create({+ data: {+ ...data,+ attributeId,+ },+ });+ }++ async deleteOrganizationAttributeOption(organizationId: number, attributeId: string, optionId: string) {+ try {+ const deletedAttributeOption = await this.dbWrite.prisma.attributeOption.delete({+ where: {+ id: optionId,+ attributeId,+ },+ });+ return deletedAttributeOption;+ } catch (error: any) {+ if (error.code === "P2025") {+ // P2025 is the Prisma error code for "Record to delete does not exist."+ this.logger.warn(`Attribute option not found: ${optionId}`);+ throw new NotFoundException("Attribute option not found");+ }+ throw error;+ }+ }++ async updateOrganizationAttributeOption(+ organizationId: number,+ attributeId: string,+ optionId: string,+ data: UpdateOrganizationAttributeOptionInput+ ) {+ return this.dbWrite.prisma.attributeOption.update({+ where: {+ id: optionId,+ attributeId,+ },+ data,+ });+ }++ async getOrganizationAttributeOptions(organizationId: number, attributeId: string) {+ return this.dbRead.prisma.attributeOption.findMany({+ where: {+ attributeId,+ },+ });+ }++ async getOrganizationAttributeOptionsForUser(organizationId: number, userId: number) {+ const options = this.dbRead.prisma.attributeOption.findMany({+ where: {+ attribute: {+ teamId: organizationId,+ },+ assignedUsers: {+ some: {+ member: {+ userId,+ },+ },+ },+ },+ });++ return options;+ }++ async assignOrganizationAttributeOptionToUser({+ organizationId,+ membershipId,+ attributeId,+ value,+ attributeOptionId,+ }: {+ organizationId: number;+ membershipId: number;+ attributeId: string;+ value?: string;+ attributeOptionId?: string;+ }) {+ let _attributeOptionId = attributeOptionId;++ if (value && !attributeOptionId) {+ _attributeOptionId = await this.createDynamicAttributeOption(organizationId, attributeId, value);+ }++ if (!_attributeOptionId) throw new Error("Attribute option not found");++ return this.dbWrite.prisma.attributeToUser.create({+ data: {+ attributeOptionId: _attributeOptionId,+ memberId: membershipId,+ },+ });+ }++ private async createDynamicAttributeOption(+ organizationId: number,+ attributeId: string,+ value: string+ ): Promise<string> {+ const attributeOption = await this.createOrganizationAttributeOption(organizationId, attributeId, {+ value: value,+ slug: slugify(value),+ });+ return attributeOption.id;+ }++ async unassignOrganizationAttributeOptionFromUser(+ organizationId: number,+ userId: number,+ attributeOptionId: string+ ) {+ const membership = await this.organizationsMembershipsService.getOrgMembershipByUserId(+ organizationId,+ userId+ );++ if (!membership) throw new Error("Membership not found");++ try {+ const deletedAttributeToUser = await this.dbWrite.prisma.attributeToUser.delete({+ where: { memberId_attributeOptionId: { memberId: membership.id, attributeOptionId } },+ });+ return deletedAttributeToUser;+ } catch (error: any) {+ if (error.code === "P2025") {+ // P2025 is the Prisma error code for "Record to delete does not exist."+ this.logger.warn(`Attribute option not found: ${attributeOptionId} for user ${userId}`);+ throw new NotFoundException("Attribute does not belong to this user");+ }+ throw error;+ }+ }+}diff --git a/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute.repository.ts b/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute.repository.tsnew file mode 100644index 00000000000..0b3a7314d34--- /dev/null+++ b/apps/api/v2/src/modules/organizations/repositories/attributes/organization-attribute.repository.ts@@ -0,0 +1,77 @@+import { CreateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/create-organization-attribute.input";+import { UpdateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/update-organization-attribute.input";+import { PrismaReadService } from "@/modules/prisma/prisma-read.service";+import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";+import { Injectable } from "@nestjs/common";++@Injectable()+export class OrganizationAttributesRepository {+ constructor(private readonly dbRead: PrismaReadService, private readonly dbWrite: PrismaWriteService) {}++ async createOrganizationAttribute(organizationId: number, data: CreateOrganizationAttributeInput) {+ const { options, ...attributeData } = data;++ const attribute = await this.dbWrite.prisma.attribute.create({+ data: {+ ...attributeData,+ teamId: organizationId,+ },+ });++ if (attribute.type === "SINGLE_SELECT" || attribute.type === "MULTI_SELECT") {+ // TODO: move this to attribute option service+ await this.dbWrite.prisma.attributeOption.createMany({+ data: options.map((option) => ({+ ...option,+ attributeId: attribute.id,+ })),+ });+ }+ return attribute;+ }++ async getOrganizationAttribute(organizationId: number, attributeId: string) {+ const attribute = await this.dbRead.prisma.attribute.findUnique({+ where: {+ id: attributeId,+ teamId: organizationId,+ },+ });+ return attribute;+ }++ async getOrganizationAttributes(organizationId: number, skip?: number, take?: number) {+ const attributes = await this.dbRead.prisma.attribute.findMany({+ where: {+ teamId: organizationId,+ },+ skip,+ take,+ });+ return attributes;+ }+ async updateOrganizationAttribute(+ organizationId: number,+ attributeId: string,+ data: UpdateOrganizationAttributeInput+ ) {+ const attribute = await this.dbWrite.prisma.attribute.update({+ where: {+ id: attributeId,+ teamId: organizationId,+ },+ data,+ });+ return attribute;+ }++ async deleteOrganizationAttribute(organizationId: number, attributeId: string) {+ const attribute = await this.dbWrite.prisma.attribute.delete({+ where: {+ id: attributeId,+ teamId: organizationId,+ },+ });+ return attribute;+ }+}diff --git a/apps/api/v2/src/modules/organizations/repositories/organizations-membership.repository.ts b/apps/api/v2/src/modules/organizations/repositories/organizations-membership.repository.tsindex 2f2d3dd9488..eca3f5afddc 100644--- a/apps/api/v2/src/modules/organizations/repositories/organizations-membership.repository.ts+++ b/apps/api/v2/src/modules/organizations/repositories/organizations-membership.repository.ts@@ -18,6 +18,15 @@ export class OrganizationsMembershipRepository {});}+ async findOrgMembershipByUserId(organizationId: number, userId: number) {+ return this.dbRead.prisma.membership.findFirst({+ where: {+ teamId: organizationId,+ userId,+ },+ });+ }+async deleteOrgMembership(organizationId: number, membershipId: number) {return this.dbWrite.prisma.membership.delete({where: {diff --git a/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes-option.service.ts b/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes-option.service.tsnew file mode 100644index 00000000000..c0f73b34b39--- /dev/null+++ b/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes-option.service.ts@@ -0,0 +1,114 @@+import { AssignOrganizationAttributeOptionToUserInput } from "@/modules/organizations/inputs/attributes/assign/organizations-attributes-options-assign.input";+import { CreateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/create-organization-attribute-option.input";+import { UpdateOrganizationAttributeOptionInput } from "@/modules/organizations/inputs/attributes/options/update-organizaiton-attribute-option.input.ts";+import { OrganizationAttributeOptionRepository } from "@/modules/organizations/repositories/attributes/organization-attribute-option.repository";+import { OrganizationAttributesService } from "@/modules/organizations/services/attributes/organization-attributes.service";+import { OrganizationsMembershipService } from "@/modules/organizations/services/organizations-membership.service";+import { BadRequestException, Injectable, Logger, NotFoundException } from "@nestjs/common";++const TYPE_SUPPORTS_VALUE = new Set(["TEXT", "NUMBER"]);++@Injectable()+export class OrganizationAttributeOptionService {+ private readonly logger = new Logger("OrganizationAttributeOptionService");+ constructor(+ private readonly organizationAttributeOptionRepository: OrganizationAttributeOptionRepository,+ private readonly organizationAttributesService: OrganizationAttributesService,+ private readonly organizationsMembershipsService: OrganizationsMembershipService+ ) {}++ async createOrganizationAttributeOption(+ organizationId: number,+ attributeId: string,+ data: CreateOrganizationAttributeOptionInput+ ) {+ return this.organizationAttributeOptionRepository.createOrganizationAttributeOption(+ organizationId,+ attributeId,+ data+ );+ }++ async deleteOrganizationAttributeOption(organizationId: number, attributeId: string, optionId: string) {+ return this.organizationAttributeOptionRepository.deleteOrganizationAttributeOption(+ organizationId,+ attributeId,+ optionId+ );+ }++ async updateOrganizationAttributeOption(+ organizationId: number,+ attributeId: string,+ optionId: string,+ data: UpdateOrganizationAttributeOptionInput+ ) {+ return this.organizationAttributeOptionRepository.updateOrganizationAttributeOption(+ organizationId,+ attributeId,+ optionId,+ data+ );+ }++ async getOrganizationAttributeOptions(organizationId: number, attributeId: string) {+ return this.organizationAttributeOptionRepository.getOrganizationAttributeOptions(+ organizationId,+ attributeId+ );+ }++ async assignOrganizationAttributeOptionToUser(+ organizationId: number,+ userId: number,+ data: AssignOrganizationAttributeOptionToUserInput+ ) {+ const attribute = await this.organizationAttributesService.getOrganizationAttribute(+ organizationId,+ data.attributeId+ );++ if (!attribute) {+ throw new NotFoundException("Attribute not found");+ }++ const membership = await this.organizationsMembershipsService.getOrgMembershipByUserId(+ organizationId,+ userId+ );++ if (!membership || !membership.accepted)+ throw new NotFoundException("User is not a member of the organization");++ if (!TYPE_SUPPORTS_VALUE.has(attribute.type) && data.value) {+ throw new BadRequestException("Attribute type does not support value");+ }++ return this.organizationAttributeOptionRepository.assignOrganizationAttributeOptionToUser({+ organizationId,+ membershipId: membership.id,+ value: data.value,+ attributeId: data.attributeId,+ attributeOptionId: data.attributeOptionId,+ });+ }++ async unassignOrganizationAttributeOptionFromUser(+ organizationId: number,+ userId: number,+ attributeOptionId: string+ ) {+ return this.organizationAttributeOptionRepository.unassignOrganizationAttributeOptionFromUser(+ organizationId,+ userId,+ attributeOptionId+ );+ }++ async getOrganizationAttributeOptionsForUser(organizationId: number, userId: number) {+ return this.organizationAttributeOptionRepository.getOrganizationAttributeOptionsForUser(+ organizationId,+ userId+ );+ }+}diff --git a/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes.service.ts b/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes.service.tsnew file mode 100644index 00000000000..2e2891feccf--- /dev/null+++ b/apps/api/v2/src/modules/organizations/services/attributes/organization-attributes.service.ts@@ -0,0 +1,36 @@+import { CreateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/create-organization-attribute.input";+import { UpdateOrganizationAttributeInput } from "@/modules/organizations/inputs/attributes/update-organization-attribute.input";+import { OrganizationAttributesRepository } from "@/modules/organizations/repositories/attributes/organization-attribute.repository";+import { Injectable } from "@nestjs/common";+++@Injectable()+export class OrganizationAttributesService {+ constructor(private readonly organizationAttributesRepository: OrganizationAttributesRepository) {}++ async createOrganizationAttribute(organizationId: number, data: CreateOrganizationAttributeInput) {+ const attribute = await this.organizationAttributesRepository.createOrganizationAttribute(organizationId, data);+ return attribute;+ }++ async getOrganizationAttribute(organizationId: number, attributeId: string) {+ const attribute = await this.organizationAttributesRepository.getOrganizationAttribute(organizationId, attributeId);+ return attribute;+ }++ async getOrganizationAttributes(organizationId: number, skip?: number, take?: number) {+ const attributes = await this.organizationAttributesRepository.getOrganizationAttributes(organizationId, skip, take);+ return attributes;+ }++ async updateOrganizationAttribute(organizationId: number, attributeId: string, data: UpdateOrganizationAttributeInput) {+ const attribute = await this.organizationAttributesRepository.updateOrganizationAttribute(organizationId, attributeId, data);+ return attribute;+ }++ async deleteOrganizationAttribute(organizationId: number, attributeId: string) {+ const attribute = await this.organizationAttributesRepository.deleteOrganizationAttribute(organizationId, attributeId);+ return attribute;+ }++}diff --git a/apps/api/v2/src/modules/organizations/services/organizations-membership.service.ts b/apps/api/v2/src/modules/organizations/services/organizations-membership.service.tsindex c1a393dbda7..7ca9490d2a2 100644--- a/apps/api/v2/src/modules/organizations/services/organizations-membership.service.ts+++ b/apps/api/v2/src/modules/organizations/services/organizations-membership.service.ts@@ -16,6 +16,14 @@ export class OrganizationsMembershipService {return membership;}+ async getOrgMembershipByUserId(organizationId: number, userId: number) {+ const membership = await this.organizationsMembershipRepository.findOrgMembershipByUserId(+ organizationId,+ userId+ );+ return membership;+ }+async getPaginatedOrgMemberships(organizationId: number, skip = 0, take = 250) {const memberships = await this.organizationsMembershipRepository.findOrgMembershipsPaginated(organizationId,diff --git a/apps/api/v2/swagger/documentation.json b/apps/api/v2/swagger/documentation.jsonindex 539c6ea9b82..fb4fbc10860 100644--- a/apps/api/v2/swagger/documentation.json+++ b/apps/api/v2/swagger/documentation.json@@ -2285,9 +2285,9 @@]}},- "/v2/organizations/{orgId}/webhooks": {+ "/v2/organizations/{orgId}/attributes": {"get": {- "operationId": "OrganizationsWebhooksController_getAllOrganizationWebhooks",+ "operationId": "OrganizationsAttributesController_getOrganizationAttributes","parameters": [{"name": "orgId",@@ -2324,18 +2324,15 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamWebhooksOutputResponseDto"+ "$ref": "#/components/schemas/GetOrganizationAttributesOutput"}}}}- },- "tags": [- "Organizations Webhooks"- ]+ }},"post": {- "operationId": "OrganizationsWebhooksController_createOrganizationWebhook",+ "operationId": "OrganizationsAttributesController_createOrganizationAttribute","parameters": [{"name": "orgId",@@ -2351,7 +2348,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CreateWebhookInputDto"+ "$ref": "#/components/schemas/CreateOrganizationAttributeInput"}}}@@ -2362,23 +2359,28 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"+ "$ref": "#/components/schemas/CreateOrganizationAttributesOutput"}}}}- },- "tags": [- "Organizations Webhooks"- ]+ }}},- "/v2/organizations/{orgId}/webhooks/{webhookId}": {+ "/v2/organizations/{orgId}/attributes/{attributeId}": {"get": {- "operationId": "OrganizationsWebhooksController_getOrganizationWebhook",+ "operationId": "OrganizationsAttributesController_getOrganizationAttribute","parameters": [{- "name": "webhookId",+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId","required": true,"in": "path","schema": {@@ -2392,21 +2394,26 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"+ "$ref": "#/components/schemas/GetSingleAttributeOutput"}}}}- },- "tags": [- "Organizations Webhooks"- ]+ }},- "delete": {- "operationId": "OrganizationsWebhooksController_deleteWebhook",+ "patch": {+ "operationId": "OrganizationsAttributesController_updateOrganizationAttribute","parameters": [{- "name": "webhookId",+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId","required": true,"in": "path","schema": {@@ -2414,27 +2421,42 @@}}],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateOrganizationAttributeInput"+ }+ }+ }+ },"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"+ "$ref": "#/components/schemas/UpdateOrganizationAttributesOutput"}}}}- },- "tags": [- "Organizations Webhooks"- ]+ }},- "patch": {- "operationId": "OrganizationsWebhooksController_updateOrgWebhook",+ "delete": {+ "operationId": "OrganizationsAttributesController_deleteOrganizationAttribute","parameters": [{- "name": "webhookId",+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId","required": true,"in": "path","schema": {@@ -2442,43 +2464,47 @@}}],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/UpdateWebhookInputDto"- }- }- }- },"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"+ "$ref": "#/components/schemas/DeleteOrganizationAttributesOutput"}}}}- },- "tags": [- "Organizations Webhooks"- ]+ }}},- "/v2/schedules": {+ "/v2/organizations/{orgId}/attributes/{attributeId}/options": {"post": {- "operationId": "SchedulesController_2024_04_15_createSchedule",- "parameters": [],+ "operationId": "OrganizationsOptionsAttributesController_createOrganizationAttributeOption",+ "parameters": [+ {+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"requestBody": {"required": true,"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CreateScheduleInput_2024_04_15"+ "$ref": "#/components/schemas/CreateOrganizationAttributeOptionInput"}}}@@ -2489,68 +2515,74 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CreateScheduleOutput_2024_04_15"+ "$ref": "#/components/schemas/CreateAttributeOptionOutput"}}}}- },- "tags": [- "Schedules"- ]+ }},"get": {- "operationId": "SchedulesController_2024_04_15_getSchedules",- "parameters": [],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/GetSchedulesOutput_2024_04_15"- }- }+ "operationId": "OrganizationsOptionsAttributesController_getOrganizationAttributeOptions",+ "parameters": [+ {+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"}}- },- "tags": [- "Schedules"- ]- }- },- "/v2/schedules/default": {- "get": {- "operationId": "SchedulesController_2024_04_15_getDefaultSchedule",- "parameters": [],+ ],"responses": {"200": {- "description": "Returns the default schedule",+ "description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetDefaultScheduleOutput_2024_04_15"+ "$ref": "#/components/schemas/GetAllAttributeOptionOutput"}}}}- },- "tags": [- "Schedules"- ]+ }}},- "/v2/schedules/{scheduleId}": {- "get": {- "operationId": "SchedulesController_2024_04_15_getSchedule",+ "/v2/organizations/{orgId}/attributes/{attributeId}/options/{optionId}": {+ "delete": {+ "operationId": "OrganizationsOptionsAttributesController_deleteOrganizationAttributeOption","parameters": [{- "name": "scheduleId",+ "name": "orgId","required": true,"in": "path","schema": {"type": "number"}+ },+ {+ "name": "attributeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "optionId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }}],"responses": {@@ -2559,21 +2591,34 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetScheduleOutput_2024_04_15"+ "$ref": "#/components/schemas/DeleteAttributeOptionOutput"}}}}- },- "tags": [- "Schedules"- ]+ }},"patch": {- "operationId": "SchedulesController_2024_04_15_updateSchedule",+ "operationId": "OrganizationsOptionsAttributesController_updateOrganizationAttributeOption","parameters": [{- "name": "scheduleId",+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "optionId","required": true,"in": "path","schema": {@@ -2586,7 +2631,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateScheduleInput_2024_04_15"+ "$ref": "#/components/schemas/UpdateOrganizationAttributeOptionInput"}}}@@ -2597,21 +2642,28 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateScheduleOutput_2024_04_15"+ "$ref": "#/components/schemas/UpdateAttributeOptionOutput"}}}}- },- "tags": [- "Schedules"- ]- },- "delete": {- "operationId": "SchedulesController_2024_04_15_deleteSchedule",+ }+ }+ },+ "/v2/organizations/{orgId}/attributes/options/{userId}": {+ "post": {+ "operationId": "OrganizationsOptionsAttributesController_assignOrganizationAttributeOptionToUser","parameters": [{- "name": "scheduleId",+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "userId","required": true,"in": "path","schema": {@@ -2619,69 +2671,87 @@}}],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/AssignOrganizationAttributeOptionToUserInput"+ }+ }+ }+ },"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DeleteScheduleOutput_2024_04_15"+ "$ref": "#/components/schemas/AssignOptionUserOutput"}}}}- },- "tags": [- "Schedules"- ]- }- },- "/v2/gcal/oauth/auth-url": {+ }+ },"get": {- "operationId": "GcalController_redirect",+ "operationId": "OrganizationsOptionsAttributesController_getOrganizationAttributeOptionsForUser","parameters": [{- "name": "Authorization",+ "name": "orgId","required": true,- "in": "header",+ "in": "path","schema": {- "type": "string"+ "type": "number"}- }- ],- "responses": {+ },+ {+ "name": "userId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ }+ ],+ "responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GcalAuthUrlOutput"+ "$ref": "#/components/schemas/GetOptionUserOutput"}}}}- },- "tags": [- "Google Calendar"- ]+ }}},- "/v2/gcal/oauth/save": {- "get": {- "operationId": "GcalController_save",+ "/v2/organizations/{orgId}/attributes/options/{userId}/{attributeOptionId}": {+ "delete": {+ "operationId": "OrganizationsOptionsAttributesController_unassignOrganizationAttributeOptionFromUser","parameters": [{- "name": "state",+ "name": "orgId","required": true,- "in": "query",+ "in": "path","schema": {- "type": "string"+ "type": "number"}},{- "name": "code",+ "name": "userId","required": true,- "in": "query",+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "attributeOptionId",+ "required": true,+ "in": "path","schema": {"type": "string"}@@ -2693,74 +2763,108 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GcalSaveRedirectOutput"+ "$ref": "#/components/schemas/UnassignOptionUserOutput"}}}}- },- "tags": [- "Google Calendar"- ]+ }}},- "/v2/gcal/check": {+ "/v2/organizations/{orgId}/webhooks": {"get": {- "operationId": "GcalController_check",- "parameters": [],+ "operationId": "OrganizationsWebhooksController_getAllOrganizationWebhooks",+ "parameters": [+ {+ "name": "orgId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "take",+ "required": false,+ "in": "query",+ "description": "The number of items to return",+ "example": 10,+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "skip",+ "required": false,+ "in": "query",+ "description": "The number of items to skip",+ "example": 0,+ "schema": {+ "type": "number"+ }+ }+ ],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GcalCheckOutput"+ "$ref": "#/components/schemas/TeamWebhooksOutputResponseDto"}}}}},"tags": [- "Google Calendar"+ "Organizations Webhooks"]- }- },- "/v2/provider/{clientId}": {- "get": {- "operationId": "CalProviderController_verifyClientId",+ },+ "post": {+ "operationId": "OrganizationsWebhooksController_createOrganizationWebhook","parameters": [{- "name": "clientId",+ "name": "orgId","required": true,"in": "path","schema": {- "type": "string"+ "type": "number"}}],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateWebhookInputDto"+ }+ }+ }+ },"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ProviderVerifyClientOutput"+ "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"}}}}},"tags": [- "Cal provider"+ "Organizations Webhooks"]}},- "/v2/provider/{clientId}/access-token": {+ "/v2/organizations/{orgId}/webhooks/{webhookId}": {"get": {- "operationId": "CalProviderController_verifyAccessToken",+ "operationId": "OrganizationsWebhooksController_getOrganizationWebhook","parameters": [{- "name": "clientId",+ "name": "webhookId","required": true,"in": "path","schema": {@@ -2774,46 +2878,62 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ProviderVerifyAccessTokenOutput"+ "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"}}}}},"tags": [- "Cal provider"+ "Organizations Webhooks"]- }- },- "/v2/me": {- "get": {- "operationId": "MeController_getMe",- "parameters": [],+ },+ "delete": {+ "operationId": "OrganizationsWebhooksController_deleteWebhook",+ "parameters": [+ {+ "name": "webhookId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetMeOutput"+ "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"}}}}},"tags": [- "Me"+ "Organizations Webhooks"]},"patch": {- "operationId": "MeController_updateMe",- "parameters": [],+ "operationId": "OrganizationsWebhooksController_updateOrgWebhook",+ "parameters": [+ {+ "name": "webhookId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"requestBody": {"required": true,"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateManagedUserInput"+ "$ref": "#/components/schemas/UpdateWebhookInputDto"}}}@@ -2824,20 +2944,49 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateMeOutput"+ "$ref": "#/components/schemas/TeamWebhookOutputResponseDto"}}}}},"tags": [- "Me"+ "Organizations Webhooks"]}},- "/v2/calendars/busy-times": {+ "/v2/schedules": {+ "post": {+ "operationId": "SchedulesController_2024_04_15_createSchedule",+ "parameters": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateScheduleInput_2024_04_15"+ }+ }+ }+ },+ "responses": {+ "201": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateScheduleOutput_2024_04_15"+ }+ }+ }+ }+ },+ "tags": [+ "Schedules"+ ]+ },"get": {- "operationId": "CalendarsController_getBusyTimes",+ "operationId": "SchedulesController_2024_04_15_getSchedules","parameters": [],"responses": {"200": {@@ -2845,56 +2994,48 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetBusyTimesOutput"+ "$ref": "#/components/schemas/GetSchedulesOutput_2024_04_15"}}}}},"tags": [- "Calendars"+ "Schedules"]}},- "/v2/calendars": {+ "/v2/schedules/default": {"get": {- "operationId": "CalendarsController_getCalendars",+ "operationId": "SchedulesController_2024_04_15_getDefaultSchedule","parameters": [],"responses": {"200": {- "description": "",+ "description": "Returns the default schedule","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/ConnectedCalendarsOutput"+ "$ref": "#/components/schemas/GetDefaultScheduleOutput_2024_04_15"}}}}},"tags": [- "Calendars"+ "Schedules"]}},- "/v2/calendars/{calendar}/connect": {+ "/v2/schedules/{scheduleId}": {"get": {- "operationId": "CalendarsController_redirect",+ "operationId": "SchedulesController_2024_04_15_getSchedule","parameters": [{- "name": "Authorization",- "required": true,- "in": "header",- "schema": {- "type": "string"- }- },- {- "name": "calendar",+ "name": "scheduleId","required": true,"in": "path","schema": {- "type": "string"+ "type": "number"}}],@@ -2904,39 +3045,21 @@"content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/GetScheduleOutput_2024_04_15"}}}}},"tags": [- "Calendars"+ "Schedules"]- }- },- "/v2/calendars/{calendar}/save": {- "get": {- "operationId": "CalendarsController_save",+ },+ "patch": {+ "operationId": "SchedulesController_2024_04_15_updateSchedule","parameters": [{- "name": "state",- "required": true,- "in": "query",- "schema": {- "type": "string"- }- },- {- "name": "code",- "required": true,- "in": "query",- "schema": {- "type": "string"- }- },- {- "name": "calendar",+ "name": "scheduleId","required": true,"in": "path","schema": {@@ -2944,49 +3067,41 @@}}],- "responses": {- "200": {- "description": ""- }- },- "tags": [- "Calendars"- ]- }- },- "/v2/calendars/{calendar}/credentials": {- "post": {- "operationId": "CalendarsController_syncCredentials",- "parameters": [- {- "name": "calendar",- "required": true,- "in": "path",- "schema": {- "type": "string"+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateScheduleInput_2024_04_15"+ }}}- ],+ },"responses": {- "201": {- "description": ""+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateScheduleOutput_2024_04_15"+ }+ }+ }}},"tags": [- "Calendars"+ "Schedules"]- }- },- "/v2/calendars/{calendar}/check": {- "get": {- "operationId": "CalendarsController_check",+ },+ "delete": {+ "operationId": "SchedulesController_2024_04_15_deleteSchedule","parameters": [{- "name": "calendar",+ "name": "scheduleId","required": true,"in": "path","schema": {- "type": "string"+ "type": "number"}}],@@ -2996,89 +3111,64 @@"content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/DeleteScheduleOutput_2024_04_15"}}}}},"tags": [- "Calendars"+ "Schedules"]}},- "/v2/calendars/{calendar}/disconnect": {- "post": {- "operationId": "CalendarsController_deleteCalendarCredentials",+ "/v2/gcal/oauth/auth-url": {+ "get": {+ "operationId": "GcalController_redirect","parameters": [{- "name": "calendar",+ "name": "Authorization","required": true,- "in": "path",+ "in": "header","schema": {"type": "string"}}],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/DeleteCalendarCredentialsInputBodyDto"- }- }- }- },"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DeletedCalendarCredentialsOutputResponseDto"+ "$ref": "#/components/schemas/GcalAuthUrlOutput"}}}}},"tags": [- "Calendars"+ "Google Calendar"]}},- "/v2/bookings": {+ "/v2/gcal/oauth/save": {"get": {- "operationId": "BookingsController_getBookings",+ "operationId": "GcalController_save","parameters": [{- "name": "cursor",- "required": false,- "in": "query",- "schema": {- "type": "number"- }- },- {- "name": "limit",- "required": false,+ "name": "state",+ "required": true,"in": "query","schema": {- "type": "number"+ "type": "string"}},{- "name": "filters[status]",+ "name": "code","required": true,"in": "query","schema": {- "enum": [- "upcoming",- "recurring",- "past",- "cancelled",- "unconfirmed"- ],"type": "string"}}@@ -3089,61 +3179,44 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetBookingsOutput"+ "$ref": "#/components/schemas/GcalSaveRedirectOutput"}}}}},"tags": [- "Bookings"+ "Google Calendar"]- },- "post": {- "operationId": "BookingsController_createBooking",- "parameters": [- {- "name": "x-cal-client-id",- "required": true,- "in": "header",- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateBookingInput"- }- }- }- },+ }+ },+ "/v2/gcal/check": {+ "get": {+ "operationId": "GcalController_check",+ "parameters": [],"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/GcalCheckOutput"}}}}},"tags": [- "Bookings"+ "Google Calendar"]}},- "/v2/bookings/{bookingUid}": {+ "/v2/provider/{clientId}": {"get": {- "operationId": "BookingsController_getBooking",+ "operationId": "CalProviderController_verifyClientId","parameters": [{- "name": "bookingUid",+ "name": "clientId","required": true,"in": "path","schema": {@@ -3157,23 +3230,23 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/GetBookingOutput"+ "$ref": "#/components/schemas/ProviderVerifyClientOutput"}}}}},"tags": [- "Bookings"+ "Cal provider"]}},- "/v2/bookings/{bookingUid}/reschedule": {+ "/v2/provider/{clientId}/access-token": {"get": {- "operationId": "BookingsController_getBookingForReschedule",+ "operationId": "CalProviderController_verifyAccessToken","parameters": [{- "name": "bookingUid",+ "name": "clientId","required": true,"in": "path","schema": {@@ -3187,173 +3260,132 @@"content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/ProviderVerifyAccessTokenOutput"}}}}},"tags": [- "Bookings"+ "Cal provider"]}},- "/v2/bookings/{bookingId}/cancel": {- "post": {- "operationId": "BookingsController_cancelBooking",- "parameters": [- {- "name": "bookingId",- "required": true,- "in": "path",- "schema": {- "type": "string"- }- },- {- "name": "x-cal-client-id",- "required": true,- "in": "header",- "schema": {- "type": "string"+ "/v2/me": {+ "get": {+ "operationId": "MeController_getMe",+ "parameters": [],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/GetMeOutput"+ }+ }}}- ],+ },+ "tags": [+ "Me"+ ]+ },+ "patch": {+ "operationId": "MeController_updateMe",+ "parameters": [],"requestBody": {"required": true,"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CancelBookingInput"+ "$ref": "#/components/schemas/UpdateManagedUserInput"}}}},"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/UpdateMeOutput"}}}}},"tags": [- "Bookings"+ "Me"]}},- "/v2/bookings/{bookingUid}/mark-no-show": {- "post": {- "operationId": "BookingsController_markNoShow",- "parameters": [- {- "name": "bookingUid",- "required": true,- "in": "path",- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/MarkNoShowInput"- }- }- }- },+ "/v2/calendars/busy-times": {+ "get": {+ "operationId": "CalendarsController_getBusyTimes",+ "parameters": [],"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/MarkNoShowOutput"+ "$ref": "#/components/schemas/GetBusyTimesOutput"}}}}},"tags": [- "Bookings"+ "Calendars"]}},- "/v2/bookings/recurring": {- "post": {- "operationId": "BookingsController_createRecurringBooking",- "parameters": [- {- "name": "x-cal-client-id",- "required": true,- "in": "header",- "schema": {- "type": "string"- }- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "type": "array",- "items": {- "type": "string"- }- }- }- }- },+ "/v2/calendars": {+ "get": {+ "operationId": "CalendarsController_getCalendars",+ "parameters": [],"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {"schema": {- "type": "object"+ "$ref": "#/components/schemas/ConnectedCalendarsOutput"}}}}},"tags": [- "Bookings"+ "Calendars"]}},- "/v2/bookings/instant": {- "post": {- "operationId": "BookingsController_createInstantBooking",+ "/v2/calendars/{calendar}/connect": {+ "get": {+ "operationId": "CalendarsController_redirect","parameters": [{- "name": "x-cal-client-id",+ "name": "Authorization","required": true,"in": "header","schema": {"type": "string"}- }- ],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/CreateBookingInput"- }+ },+ {+ "name": "calendar",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"}}- },+ ],"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {@@ -3365,87 +3397,85 @@}},"tags": [- "Bookings"+ "Calendars"]}},- "/v2/slots/reserve": {- "post": {- "operationId": "SlotsController_reserveSlot",- "parameters": [],- "requestBody": {- "required": true,- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/ReserveSlotInput"- }+ "/v2/calendars/{calendar}/save": {+ "get": {+ "operationId": "CalendarsController_save",+ "parameters": [+ {+ "name": "state",+ "required": true,+ "in": "query",+ "schema": {+ "type": "string"}- }- },- "responses": {- "201": {- "description": "",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }+ },+ {+ "name": "code",+ "required": true,+ "in": "query",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "calendar",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"}}- },- "tags": [- "Slots"- ]- }- },- "/v2/slots/selected-slot": {- "delete": {- "operationId": "SlotsController_deleteSelectedSlot",- "parameters": [],+ ],"responses": {"200": {- "description": "",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }- }+ "description": ""}},"tags": [- "Slots"+ "Calendars"]}},- "/v2/slots/available": {- "get": {- "operationId": "SlotsController_getAvailableSlots",- "parameters": [],- "responses": {- "200": {- "description": "",- "content": {- "application/json": {- "schema": {- "type": "object"- }- }+ "/v2/calendars/{calendar}/credentials": {+ "post": {+ "operationId": "CalendarsController_syncCredentials",+ "parameters": [+ {+ "name": "calendar",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"}}+ ],+ "responses": {+ "201": {+ "description": ""+ }},"tags": [- "Slots"+ "Calendars"]}},- "/v2/timezones": {+ "/v2/calendars/{calendar}/check": {"get": {- "operationId": "TimezonesController_getTimeZones",- "parameters": [],+ "operationId": "CalendarsController_check",+ "parameters": [+ {+ "name": "calendar",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"responses": {"200": {"description": "",@@ -3459,64 +3489,84 @@}},"tags": [- "Timezones"+ "Calendars"]}},- "/v2/webhooks": {+ "/v2/calendars/{calendar}/disconnect": {"post": {- "operationId": "WebhooksController_createWebhook",- "summary": "Create a webhook",- "parameters": [],+ "operationId": "CalendarsController_deleteCalendarCredentials",+ "parameters": [+ {+ "name": "calendar",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"requestBody": {"required": true,"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CreateWebhookInputDto"+ "$ref": "#/components/schemas/DeleteCalendarCredentialsInputBodyDto"}}}},"responses": {- "201": {+ "200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ "$ref": "#/components/schemas/DeletedCalendarCredentialsOutputResponseDto"}}}}},"tags": [- "Users' Webhooks"+ "Calendars"]- },+ }+ },+ "/v2/bookings": {"get": {- "operationId": "WebhooksController_getWebhooks",- "summary": "Get all user webhooks paginated",+ "operationId": "BookingsController_getBookings","parameters": [{- "name": "take",+ "name": "cursor","required": false,"in": "query",- "description": "The number of items to return",- "example": 10,"schema": {"type": "number"}},{- "name": "skip",+ "name": "limit","required": false,"in": "query",- "description": "The number of items to skip",- "example": 0,"schema": {"type": "number"}+ },+ {+ "name": "filters[status]",+ "required": true,+ "in": "query",+ "schema": {+ "enum": [+ "upcoming",+ "recurring",+ "past",+ "cancelled",+ "unconfirmed"+ ],+ "type": "string"+ }}],"responses": {@@ -3525,26 +3575,23 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UserWebhooksOutputResponseDto"+ "$ref": "#/components/schemas/GetBookingsOutput"}}}}},"tags": [- "Users' Webhooks"+ "Bookings"]- }- },- "/v2/webhooks/{webhookId}": {- "patch": {- "operationId": "WebhooksController_updateWebhook",- "summary": "Update a webhook",+ },+ "post": {+ "operationId": "BookingsController_createBooking","parameters": [{- "name": "webhookId",+ "name": "x-cal-client-id","required": true,- "in": "path",+ "in": "header","schema": {"type": "string"}@@ -3555,53 +3602,64 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateWebhookInputDto"+ "$ref": "#/components/schemas/CreateBookingInput"}}}},"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' Webhooks"+ "Bookings"]- },- "get": {- "operationId": "WebhooksController_getWebhook",- "summary": "Get a webhook",- "parameters": [],+ }+ },+ "/v2/bookings/{bookingUid}": {+ "get": {+ "operationId": "BookingsController_getBooking",+ "parameters": [+ {+ "name": "bookingUid",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ "$ref": "#/components/schemas/GetBookingOutput"}}}}},"tags": [- "Users' Webhooks"+ "Bookings"]- },- "delete": {- "operationId": "WebhooksController_deleteWebhook",- "summary": "Delete a webhook",+ }+ },+ "/v2/bookings/{bookingUid}/reschedule": {+ "get": {+ "operationId": "BookingsController_getBookingForReschedule","parameters": [{- "name": "webhookId",+ "name": "bookingUid","required": true,"in": "path","schema": {@@ -3615,28 +3673,35 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' Webhooks"+ "Bookings"]}},- "/v2/event-types/{eventTypeId}/webhooks": {+ "/v2/bookings/{bookingId}/cancel": {"post": {- "operationId": "EventTypeWebhooksController_createEventTypeWebhook",- "summary": "Create a webhook for an event-type",+ "operationId": "BookingsController_cancelBooking","parameters": [{- "name": "eventTypeId",+ "name": "bookingId","required": true,"in": "path","schema": {- "type": "number"+ "type": "string"+ }+ },+ {+ "name": "x-cal-client-id",+ "required": true,+ "in": "header",+ "schema": {+ "type": "string"}}],@@ -3645,7 +3710,7 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/CreateWebhookInputDto"+ "$ref": "#/components/schemas/CancelBookingInput"}}}@@ -3656,104 +3721,108 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Bookings"]- },- "get": {- "operationId": "EventTypeWebhooksController_getEventTypeWebhooks",- "summary": "Get all webhooks of an event-type",+ }+ },+ "/v2/bookings/{bookingUid}/mark-no-show": {+ "post": {+ "operationId": "BookingsController_markNoShow","parameters": [{- "name": "eventTypeId",+ "name": "bookingUid","required": true,"in": "path","schema": {- "type": "number"- }- },- {- "name": "take",- "required": false,- "in": "query",- "description": "The number of items to return",- "example": 10,- "schema": {- "type": "number"- }- },- {- "name": "skip",- "required": false,- "in": "query",- "description": "The number of items to skip",- "example": 0,- "schema": {- "type": "number"+ "type": "string"}}],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MarkNoShowInput"+ }+ }+ }+ },"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EventTypeWebhooksOutputResponseDto"+ "$ref": "#/components/schemas/MarkNoShowOutput"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Bookings"]- },- "delete": {- "operationId": "EventTypeWebhooksController_deleteAllEventTypeWebhooks",- "summary": "Delete all webhooks of an event-type",+ }+ },+ "/v2/bookings/recurring": {+ "post": {+ "operationId": "BookingsController_createRecurringBooking","parameters": [{- "name": "eventTypeId",+ "name": "x-cal-client-id","required": true,- "in": "path",+ "in": "header","schema": {- "type": "number"+ "type": "string"}}],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "type": "string"+ }+ }+ }+ }+ },"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DeleteManyWebhooksOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Bookings"]}},- "/v2/event-types/{eventTypeId}/webhooks/{webhookId}": {- "patch": {- "operationId": "EventTypeWebhooksController_updateEventTypeWebhook",- "summary": "Update a webhook of an event-type",+ "/v2/bookings/instant": {+ "post": {+ "operationId": "BookingsController_createInstantBooking","parameters": [{- "name": "webhookId",+ "name": "x-cal-client-id","required": true,- "in": "path",+ "in": "header","schema": {"type": "string"}@@ -3764,30 +3833,83 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/UpdateWebhookInputDto"+ "$ref": "#/components/schemas/CreateBookingInput"+ }+ }+ }+ },+ "responses": {+ "201": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "type": "object"+ }+ }+ }+ }+ },+ "tags": [+ "Bookings"+ ]+ }+ },+ "/v2/slots/reserve": {+ "post": {+ "operationId": "SlotsController_reserveSlot",+ "parameters": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/ReserveSlotInput"+ }+ }+ }+ },+ "responses": {+ "201": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "type": "object"+ }}}}},+ "tags": [+ "Slots"+ ]+ }+ },+ "/v2/slots/selected-slot": {+ "delete": {+ "operationId": "SlotsController_deleteSelectedSlot",+ "parameters": [],"responses": {"200": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Slots"]- },+ }+ },+ "/v2/slots/available": {"get": {- "operationId": "EventTypeWebhooksController_getEventTypeWebhook",- "summary": "Get a webhook of an event-type",+ "operationId": "SlotsController_getAvailableSlots","parameters": [],"responses": {"200": {@@ -3795,19 +3917,20 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Slots"]- },- "delete": {- "operationId": "EventTypeWebhooksController_deleteEventTypeWebhook",- "summary": "Delete a webhook of an event-type",+ }+ },+ "/v2/timezones": {+ "get": {+ "operationId": "TimezonesController_getTimeZones","parameters": [],"responses": {"200": {@@ -3815,31 +3938,22 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"+ "type": "object"}}}}},"tags": [- "Users' EventTypes Webhooks"+ "Timezones"]}},- "/v2/oauth-clients/{clientId}/webhooks": {+ "/v2/webhooks": {"post": {- "operationId": "OAuthClientWebhooksController_createOAuthClientWebhook",- "summary": "Create a webhook for an oAuthClient",- "parameters": [- {- "name": "clientId",- "required": true,- "in": "path",- "schema": {- "type": "string"- }- }- ],+ "operationId": "WebhooksController_createWebhook",+ "summary": "Create a webhook",+ "parameters": [],"requestBody": {"required": true,"content": {@@ -3856,27 +3970,199 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ "$ref": "#/components/schemas/UserWebhookOutputResponseDto"}}}}},"tags": [- "OAuthClients Webhooks"+ "Users' Webhooks"]},"get": {- "operationId": "OAuthClientWebhooksController_getOAuthClientWebhooks",- "summary": "Get all webhooks of an oAuthClient",+ "operationId": "WebhooksController_getWebhooks",+ "summary": "Get all user webhooks paginated","parameters": [{- "name": "clientId",+ "name": "take",+ "required": false,+ "in": "query",+ "description": "The number of items to return",+ "example": 10,+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "skip",+ "required": false,+ "in": "query",+ "description": "The number of items to skip",+ "example": 0,+ "schema": {+ "type": "number"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UserWebhooksOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Users' Webhooks"+ ]+ }+ },+ "/v2/webhooks/{webhookId}": {+ "patch": {+ "operationId": "WebhooksController_updateWebhook",+ "summary": "Update a webhook",+ "parameters": [+ {+ "name": "webhookId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateWebhookInputDto"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Users' Webhooks"+ ]+ },+ "get": {+ "operationId": "WebhooksController_getWebhook",+ "summary": "Get a webhook",+ "parameters": [],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Users' Webhooks"+ ]+ },+ "delete": {+ "operationId": "WebhooksController_deleteWebhook",+ "summary": "Delete a webhook",+ "parameters": [+ {+ "name": "webhookId","required": true,"in": "path","schema": {"type": "string"}+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UserWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Users' Webhooks"+ ]+ }+ },+ "/v2/event-types/{eventTypeId}/webhooks": {+ "post": {+ "operationId": "EventTypeWebhooksController_createEventTypeWebhook",+ "summary": "Create a webhook for an event-type",+ "parameters": [+ {+ "name": "eventTypeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/CreateWebhookInputDto"+ }+ }+ }+ },+ "responses": {+ "201": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Users' EventTypes Webhooks"+ ]+ },+ "get": {+ "operationId": "EventTypeWebhooksController_getEventTypeWebhooks",+ "summary": "Get all webhooks of an event-type",+ "parameters": [+ {+ "name": "eventTypeId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "number"+ }},{"name": "take",@@ -3905,26 +4191,26 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/OAuthClientWebhooksOutputResponseDto"+ "$ref": "#/components/schemas/EventTypeWebhooksOutputResponseDto"}}}}},"tags": [- "OAuthClients Webhooks"+ "Users' EventTypes Webhooks"]},"delete": {- "operationId": "OAuthClientWebhooksController_deleteAllOAuthClientWebhooks",- "summary": "Delete all webhooks of an oAuthClient",+ "operationId": "EventTypeWebhooksController_deleteAllEventTypeWebhooks",+ "summary": "Delete all webhooks of an event-type","parameters": [{- "name": "clientId",+ "name": "eventTypeId","required": true,"in": "path","schema": {- "type": "string"+ "type": "number"}}],@@ -3941,14 +4227,14 @@}},"tags": [- "OAuthClients Webhooks"+ "Users' EventTypes Webhooks"]}},- "/v2/oauth-clients/{clientId}/webhooks/{webhookId}": {+ "/v2/event-types/{eventTypeId}/webhooks/{webhookId}": {"patch": {- "operationId": "OAuthClientWebhooksController_updateOAuthClientWebhook",- "summary": "Update a webhook of an oAuthClient",+ "operationId": "EventTypeWebhooksController_updateEventTypeWebhook",+ "summary": "Update a webhook of an event-type","parameters": [{"name": "webhookId",@@ -3975,19 +4261,19 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"}}}}},"tags": [- "OAuthClients Webhooks"+ "Users' EventTypes Webhooks"]},"get": {- "operationId": "OAuthClientWebhooksController_getOAuthClientWebhook",- "summary": "Get a webhook of an oAuthClient",+ "operationId": "EventTypeWebhooksController_getEventTypeWebhook",+ "summary": "Get a webhook of an event-type","parameters": [],"responses": {"200": {@@ -3995,19 +4281,19 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"}}}}},"tags": [- "OAuthClients Webhooks"+ "Users' EventTypes Webhooks"]},"delete": {- "operationId": "OAuthClientWebhooksController_deleteOAuthClientWebhook",- "summary": "Delete a webhook of an oAuthClient",+ "operationId": "EventTypeWebhooksController_deleteEventTypeWebhook",+ "summary": "Delete a webhook of an event-type","parameters": [],"responses": {"200": {@@ -4015,57 +4301,257 @@"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ "$ref": "#/components/schemas/EventTypeWebhookOutputResponseDto"}}}}},"tags": [- "OAuthClients Webhooks"+ "Users' EventTypes Webhooks"]}},- "/v2/destination-calendars": {- "put": {- "operationId": "DestinationCalendarsController_updateDestinationCalendars",- "parameters": [],+ "/v2/oauth-clients/{clientId}/webhooks": {+ "post": {+ "operationId": "OAuthClientWebhooksController_createOAuthClientWebhook",+ "summary": "Create a webhook for an oAuthClient",+ "parameters": [+ {+ "name": "clientId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],"requestBody": {"required": true,"content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DestinationCalendarsInputBodyDto"+ "$ref": "#/components/schemas/CreateWebhookInputDto"}}}},"responses": {- "200": {+ "201": {"description": "","content": {"application/json": {"schema": {- "$ref": "#/components/schemas/DestinationCalendarsOutputResponseDto"+ "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"}}}}},"tags": [- "Destination-Calendars",- "Select a third party destination calendar where events will be created"+ "OAuthClients Webhooks"]- }- }- },- "info": {- "title": "Cal.com v2 API",- "description": "",- "version": "1.0.0",- "contact": {}- },- "tags": [],+ },+ "get": {+ "operationId": "OAuthClientWebhooksController_getOAuthClientWebhooks",+ "summary": "Get all webhooks of an oAuthClient",+ "parameters": [+ {+ "name": "clientId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "take",+ "required": false,+ "in": "query",+ "description": "The number of items to return",+ "example": 10,+ "schema": {+ "type": "number"+ }+ },+ {+ "name": "skip",+ "required": false,+ "in": "query",+ "description": "The number of items to skip",+ "example": 0,+ "schema": {+ "type": "number"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthClientWebhooksOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "OAuthClients Webhooks"+ ]+ },+ "delete": {+ "operationId": "OAuthClientWebhooksController_deleteAllOAuthClientWebhooks",+ "summary": "Delete all webhooks of an oAuthClient",+ "parameters": [+ {+ "name": "clientId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/DeleteManyWebhooksOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "OAuthClients Webhooks"+ ]+ }+ },+ "/v2/oauth-clients/{clientId}/webhooks/{webhookId}": {+ "patch": {+ "operationId": "OAuthClientWebhooksController_updateOAuthClientWebhook",+ "summary": "Update a webhook of an oAuthClient",+ "parameters": [+ {+ "name": "webhookId",+ "required": true,+ "in": "path",+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/UpdateWebhookInputDto"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "OAuthClients Webhooks"+ ]+ },+ "get": {+ "operationId": "OAuthClientWebhooksController_getOAuthClientWebhook",+ "summary": "Get a webhook of an oAuthClient",+ "parameters": [],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "OAuthClients Webhooks"+ ]+ },+ "delete": {+ "operationId": "OAuthClientWebhooksController_deleteOAuthClientWebhook",+ "summary": "Delete a webhook of an oAuthClient",+ "parameters": [],+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/OAuthClientWebhookOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "OAuthClients Webhooks"+ ]+ }+ },+ "/v2/destination-calendars": {+ "put": {+ "operationId": "DestinationCalendarsController_updateDestinationCalendars",+ "parameters": [],+ "requestBody": {+ "required": true,+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/DestinationCalendarsInputBodyDto"+ }+ }+ }+ },+ "responses": {+ "200": {+ "description": "",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/DestinationCalendarsOutputResponseDto"+ }+ }+ }+ }+ },+ "tags": [+ "Destination-Calendars",+ "Select a third party destination calendar where events will be created"+ ]+ }+ }+ },+ "info": {+ "title": "Cal.com v2 API",+ "description": "",+ "version": "1.0.0",+ "contact": {}+ },+ "tags": [],"servers": [],"components": {"schemas": {@@ -7246,49 +7732,592 @@"assignAllTeamMembers": {"type": "boolean"},- "bookingLimitsCount": {- "$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"+ "bookingLimitsCount": {+ "$ref": "#/components/schemas/BookingLimitsCount_2024_06_14"+ },+ "onlyShowFirstAvailableSlot": {+ "type": "boolean"+ },+ "bookingLimitsDuration": {+ "$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"+ },+ "bookingWindow": {+ "type": "object"+ },+ "offsetStart": {+ "type": "number",+ "minimum": 1+ }+ },+ "required": [+ "id",+ "lengthInMinutes",+ "title",+ "slug",+ "description",+ "locations",+ "bookingFields",+ "disableGuests",+ "schedulingType",+ "recurrence",+ "metadata",+ "requiresConfirmation",+ "price",+ "currency",+ "lockTimeZoneToggleOnBookingPage",+ "seatsPerTimeSlot",+ "forwardParamsSuccessRedirect",+ "successRedirectUrl",+ "seatsShowAvailabilityCount",+ "isInstantEvent",+ "scheduleId",+ "hosts"+ ]+ },+ "GetTeamEventTypeOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "GetTeamEventTypesOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"+ }+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "UpdateTeamEventTypeInput_2024_06_14": {+ "type": "object",+ "properties": {+ "lengthInMinutes": {+ "type": "number"+ },+ "title": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ },+ "description": {+ "type": "string"+ },+ "locations": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "bookingFields": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "disableGuests": {+ "type": "boolean"+ },+ "slotInterval": {+ "type": "number"+ },+ "minimumBookingNotice": {+ "type": "number"+ },+ "beforeEventBuffer": {+ "type": "number"+ },+ "afterEventBuffer": {+ "type": "number"+ },+ "hosts": {+ "type": "array",+ "items": {+ "type": "string"+ }+ },+ "assignAllTeamMembers": {+ "type": "boolean"+ }+ },+ "required": [+ "lengthInMinutes",+ "title",+ "slug",+ "description",+ "locations",+ "bookingFields",+ "disableGuests",+ "slotInterval",+ "minimumBookingNotice",+ "beforeEventBuffer",+ "afterEventBuffer",+ "hosts",+ "assignAllTeamMembers"+ ]+ },+ "UpdateTeamEventTypeOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "oneOf": [+ {+ "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"+ },+ {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"+ }+ }+ ]+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "DeleteTeamEventTypeOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "type": "object"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "OrgTeamMembershipOutputDto": {+ "type": "object",+ "properties": {+ "role": {+ "type": "string",+ "enum": [+ "MEMBER",+ "OWNER",+ "ADMIN"+ ]+ },+ "id": {+ "type": "number"+ },+ "userId": {+ "type": "number"+ },+ "teamId": {+ "type": "number"+ },+ "accepted": {+ "type": "boolean"+ },+ "disableImpersonation": {+ "type": "boolean"+ }+ },+ "required": [+ "role",+ "id",+ "userId",+ "teamId",+ "accepted"+ ]+ },+ "OrgTeamMembershipsOutputResponseDto": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/OrgTeamMembershipOutputDto"+ }+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "OrgTeamMembershipOutputResponseDto": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "$ref": "#/components/schemas/OrgTeamMembershipOutputDto"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "UpdateOrgTeamMembershipDto": {+ "type": "object",+ "properties": {+ "role": {+ "type": "string",+ "default": "MEMBER",+ "enum": [+ "MEMBER",+ "OWNER",+ "ADMIN"+ ]+ },+ "accepted": {+ "type": "boolean",+ "default": false+ },+ "disableImpersonation": {+ "type": "boolean",+ "default": false+ }+ }+ },+ "CreateOrgTeamMembershipDto": {+ "type": "object",+ "properties": {+ "role": {+ "type": "string",+ "default": "MEMBER",+ "enum": [+ "MEMBER",+ "OWNER",+ "ADMIN"+ ]+ },+ "userId": {+ "type": "number"+ },+ "accepted": {+ "type": "boolean",+ "default": false+ },+ "disableImpersonation": {+ "type": "boolean",+ "default": false+ }+ },+ "required": [+ "role",+ "userId"+ ]+ },+ "Attribute": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "The ID of the attribute",+ "example": "attr_123"+ },+ "teamId": {+ "type": "number",+ "description": "The team ID associated with the attribute",+ "example": 1+ },+ "type": {+ "type": "string",+ "description": "The type of the attribute",+ "enum": [+ "TEXT",+ "NUMBER",+ "SINGLE_SELECT",+ "MULTI_SELECT"+ ]+ },+ "name": {+ "type": "string",+ "description": "The name of the attribute",+ "example": "Attribute Name"+ },+ "slug": {+ "type": "string",+ "description": "The slug of the attribute",+ "example": "attribute-name"+ },+ "enabled": {+ "type": "boolean",+ "description": "Whether the attribute is enabled and displayed on their profile",+ "example": true+ },+ "usersCanEditRelation": {+ "type": "boolean",+ "description": "Whether users can edit the relation",+ "example": true+ }+ },+ "required": [+ "id",+ "teamId",+ "type",+ "name",+ "slug",+ "enabled"+ ]+ },+ "GetOrganizationAttributesOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Attribute"+ }+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "GetSingleAttributeOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "nullable": true,+ "allOf": [+ {+ "$ref": "#/components/schemas/Attribute"+ }+ ]+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "CreateOrganizationAttributeOptionInput": {+ "type": "object",+ "properties": {+ "value": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ }+ },+ "required": [+ "value",+ "slug"+ ]+ },+ "CreateOrganizationAttributeInput": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ },+ "type": {+ "type": "object"+ },+ "options": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CreateOrganizationAttributeOptionInput"+ }+ },+ "enabled": {+ "type": "boolean"+ }+ },+ "required": [+ "name",+ "slug",+ "type",+ "options"+ ]+ },+ "CreateOrganizationAttributesOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "$ref": "#/components/schemas/Attribute"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "UpdateOrganizationAttributeInput": {+ "type": "object",+ "properties": {+ "name": {+ "type": "string"+ },+ "slug": {+ "type": "string"+ },+ "type": {+ "type": "object"+ },+ "enabled": {+ "type": "boolean"+ }+ }+ },+ "UpdateOrganizationAttributesOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]+ },+ "data": {+ "$ref": "#/components/schemas/Attribute"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "DeleteOrganizationAttributesOutput": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "example": "success",+ "enum": [+ "success",+ "error"+ ]},- "onlyShowFirstAvailableSlot": {- "type": "boolean"+ "data": {+ "$ref": "#/components/schemas/Attribute"+ }+ },+ "required": [+ "status",+ "data"+ ]+ },+ "OptionOutput": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "The ID of the option",+ "example": "attr_option_id"},- "bookingLimitsDuration": {- "$ref": "#/components/schemas/BookingLimitsDuration_2024_06_14"+ "attributeId": {+ "type": "string",+ "description": "The ID of the attribute",+ "example": "attr_id"},- "bookingWindow": {- "type": "object"+ "value": {+ "type": "string",+ "description": "The value of the option",+ "example": "option_value"},- "offsetStart": {- "type": "number",- "minimum": 1+ "slug": {+ "type": "string",+ "description": "The slug of the option",+ "example": "option-slug"}},"required": ["id",- "lengthInMinutes",- "title",- "slug",- "description",- "locations",- "bookingFields",- "disableGuests",- "schedulingType",- "recurrence",- "metadata",- "requiresConfirmation",- "price",- "currency",- "lockTimeZoneToggleOnBookingPage",- "seatsPerTimeSlot",- "forwardParamsSuccessRedirect",- "successRedirectUrl",- "seatsShowAvailabilityCount",- "isInstantEvent",- "scheduleId",- "hosts"+ "attributeId",+ "value",+ "slug"]},- "GetTeamEventTypeOutput": {+ "CreateAttributeOptionOutput": {"type": "object","properties": {"status": {@@ -7300,7 +8329,7 @@]},"data": {- "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"+ "$ref": "#/components/schemas/OptionOutput"}},"required": [@@ -7308,7 +8337,7 @@"data"]},- "GetTeamEventTypesOutput": {+ "DeleteAttributeOptionOutput": {"type": "object","properties": {"status": {@@ -7320,10 +8349,7 @@]},"data": {- "type": "array",- "items": {- "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"- }+ "$ref": "#/components/schemas/OptionOutput"}},"required": [@@ -7331,75 +8357,18 @@"data"]},- "UpdateTeamEventTypeInput_2024_06_14": {+ "UpdateOrganizationAttributeOptionInput": {"type": "object","properties": {- "lengthInMinutes": {- "type": "number"- },- "title": {+ "value": {"type": "string"},"slug": {"type": "string"- },- "description": {- "type": "string"- },- "locations": {- "type": "array",- "items": {- "type": "string"- }- },- "bookingFields": {- "type": "array",- "items": {- "type": "string"- }- },- "disableGuests": {- "type": "boolean"- },- "slotInterval": {- "type": "number"- },- "minimumBookingNotice": {- "type": "number"- },- "beforeEventBuffer": {- "type": "number"- },- "afterEventBuffer": {- "type": "number"- },- "hosts": {- "type": "array",- "items": {- "type": "string"- }- },- "assignAllTeamMembers": {- "type": "boolean"}- },- "required": [- "lengthInMinutes",- "title",- "slug",- "description",- "locations",- "bookingFields",- "disableGuests",- "slotInterval",- "minimumBookingNotice",- "beforeEventBuffer",- "afterEventBuffer",- "hosts",- "assignAllTeamMembers"- ]+ }},- "UpdateTeamEventTypeOutput": {+ "UpdateAttributeOptionOutput": {"type": "object","properties": {"status": {@@ -7411,17 +8380,7 @@]},"data": {- "oneOf": [- {- "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"- },- {- "type": "array",- "items": {- "$ref": "#/components/schemas/TeamEventTypeOutput_2024_06_14"- }- }- ]+ "$ref": "#/components/schemas/OptionOutput"}},"required": [@@ -7429,7 +8388,7 @@"data"]},- "DeleteTeamEventTypeOutput": {+ "GetAllAttributeOptionOutput": {"type": "object","properties": {"status": {@@ -7441,7 +8400,10 @@]},"data": {- "type": "object"+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/OptionOutput"+ }}},"required": [@@ -7449,42 +8411,46 @@"data"]},- "OrgTeamMembershipOutputDto": {+ "AssignOrganizationAttributeOptionToUserInput": {"type": "object","properties": {- "role": {- "type": "string",- "enum": [- "MEMBER",- "OWNER",- "ADMIN"- ]- },- "id": {- "type": "number"+ "value": {+ "type": "string"},- "userId": {- "type": "number"+ "attributeOptionId": {+ "type": "string"},- "teamId": {- "type": "number"+ "attributeId": {+ "type": "string"+ }+ },+ "required": [+ "attributeId"+ ]+ },+ "AssignOptionUserOutputData": {+ "type": "object",+ "properties": {+ "id": {+ "type": "string",+ "description": "The ID of the option assigned to the user"},- "accepted": {- "type": "boolean"+ "memberId": {+ "type": "number",+ "description": "The ID form the org membership for the user"},- "disableImpersonation": {- "type": "boolean"+ "attributeOptionId": {+ "type": "string",+ "description": "The value of the option"}},"required": [- "role","id",- "userId",- "teamId",- "accepted"+ "memberId",+ "attributeOptionId"]},- "OrgTeamMembershipsOutputResponseDto": {+ "AssignOptionUserOutput": {"type": "object","properties": {"status": {@@ -7496,10 +8462,7 @@]},"data": {- "type": "array",- "items": {- "$ref": "#/components/schemas/OrgTeamMembershipOutputDto"- }+ "$ref": "#/components/schemas/AssignOptionUserOutputData"}},"required": [@@ -7507,7 +8470,7 @@"data"]},- "OrgTeamMembershipOutputResponseDto": {+ "UnassignOptionUserOutput": {"type": "object","properties": {"status": {@@ -7519,7 +8482,7 @@]},"data": {- "$ref": "#/components/schemas/OrgTeamMembershipOutputDto"+ "$ref": "#/components/schemas/AssignOptionUserOutputData"}},"required": [@@ -7527,55 +8490,54 @@"data"]},- "UpdateOrgTeamMembershipDto": {+ "GetOptionUserOutputData": {"type": "object","properties": {- "role": {+ "id": {"type": "string",- "default": "MEMBER",- "enum": [- "MEMBER",- "OWNER",- "ADMIN"- ]+ "description": "The ID of the option assigned to the user"},- "accepted": {- "type": "boolean",- "default": false+ "attributeId": {+ "type": "string",+ "description": "The ID of the attribute"},- "disableImpersonation": {- "type": "boolean",- "default": false+ "value": {+ "type": "string",+ "description": "The value of the option"+ },+ "slug": {+ "type": "string",+ "description": "The slug of the option"}- }+ },+ "required": [+ "id",+ "attributeId",+ "value",+ "slug"+ ]},- "CreateOrgTeamMembershipDto": {+ "GetOptionUserOutput": {"type": "object","properties": {- "role": {+ "status": {"type": "string",- "default": "MEMBER",+ "example": "success","enum": [- "MEMBER",- "OWNER",- "ADMIN"+ "success",+ "error"]},- "userId": {- "type": "number"- },- "accepted": {- "type": "boolean",- "default": false- },- "disableImpersonation": {- "type": "boolean",- "default": false+ "data": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/GetOptionUserOutputData"+ }}},"required": [- "role",- "userId"+ "status",+ "data"]},"TeamWebhookOutputDto": {diff --git a/apps/api/v2/test/fixtures/repository/attributes.repository.fixture.ts b/apps/api/v2/test/fixtures/repository/attributes.repository.fixture.tsnew file mode 100644index 00000000000..c33d247a6ae--- /dev/null+++ b/apps/api/v2/test/fixtures/repository/attributes.repository.fixture.ts@@ -0,0 +1,30 @@+import { PrismaReadService } from "@/modules/prisma/prisma-read.service";+import { PrismaWriteService } from "@/modules/prisma/prisma-write.service";+import { TestingModule } from "@nestjs/testing";+import { Prisma, User } from "@prisma/client";++export class AttributeRepositoryFixture {+ private prismaReadClient: PrismaReadService["prisma"];+ private prismaWriteClient: PrismaWriteService["prisma"];++ constructor(private readonly module: TestingModule) {+ this.prismaReadClient = module.get(PrismaReadService).prisma;+ this.prismaWriteClient = module.get(PrismaWriteService).prisma;+ }++ async create(data: Prisma.AttributeCreateInput) {+ return this.prismaWriteClient.attribute.create({ data });+ }++ async createOption(data: Prisma.AttributeOptionCreateInput) {+ return this.prismaWriteClient.attributeOption.create({ data });+ }++ async delete(id: string) {+ return this.prismaWriteClient.attribute.delete({ where: { id } });+ }++ async deleteOption(id: string) {+ return this.prismaWriteClient.attributeOption.delete({ where: { id } });+ }+}diff --git a/i18n.json b/i18n.jsonindex 2761b147de5..c81e05b176f 100644--- a/i18n.json+++ b/i18n.json@@ -24,9 +24,7 @@},"buckets": {"json": {- "include": [- "apps/web/public/static/locales/[locale]/common.json"- ]+ "include": ["apps/web/public/static/locales/[locale]/common.json"]}}-}\ No newline at end of file+}