chore: Add summaries for all API v2 endpoints (#16776)

* chore: Add summaries for all API v2 endpoints

* Updated to Get all calendars

* Fix build issues

* Removed unneeded Swagger UI options

* Fix issues with OpenAPI spec
This commit is contained in:
Keith Williams authored and GitHub committed 2024-09-24 08:12:46 -03:00
1 parent 2e2a6c73b1
commit f94494b91e
28 files changed
+490 -202

No files matched your search

@@ -9,7 +9,7 @@ import {
import { DestinationCalendarsService } from "@/modules/destination-calendars/services/destination-calendars.service";
import { UserWithProfile } from "@/modules/users/users.repository";
import { Body, Controller, Put, UseGuards } from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -18,13 +18,13 @@ import { SUCCESS_STATUS } from "@calcom/platform-constants";
path: "/v2/destination-calendars",
version: API_VERSIONS_VALUES,
})
@DocsTags("Destination-Calendars")
@DocsTags("Destination Calendars")
export class DestinationCalendarsController {
constructor(private readonly destinationCalendarsService: DestinationCalendarsService) {}
@Put("/")
@UseGuards(ApiAuthGuard)
@DocsTags("Select a third party destination calendar where events will be created")
@ApiOperation({ summary: "Update destination calendars" })
async updateDestinationCalendars(
@Body() input: DestinationCalendarsInputBodyDto,
@GetUser() user: UserWithProfile
@@ -25,7 +25,7 @@ import {
Patch,
ParseIntPipe,
} from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { Webhook } from "@prisma/client";
import { plainToClass } from "class-transformer";
@@ -37,7 +37,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsUserEventTypeWebhookGuard)
@ApiTags("Users' EventTypes Webhooks")
@DocsTags("Event Types / Webhooks")
export class EventTypeWebhooksController {
constructor(
private readonly webhooksService: WebhooksService,
@@ -45,7 +45,7 @@ export class EventTypeWebhooksController {
) {}
@Post("/")
@ApiOperation({ summary: "Create a webhook for an event-type" })
@ApiOperation({ summary: "Create a webhook" })
async createEventTypeWebhook(
@Body() body: CreateWebhookInputDto,
@Param("eventTypeId", ParseIntPipe) eventTypeId: number
@@ -63,7 +63,7 @@ export class EventTypeWebhooksController {
}
@Patch("/:webhookId")
@ApiOperation({ summary: "Update a webhook of an event-type" })
@ApiOperation({ summary: "Update a webhook" })
async updateEventTypeWebhook(
@Body() body: UpdateWebhookInputDto,
@Param("webhookId") webhookId: string
@@ -81,7 +81,7 @@ export class EventTypeWebhooksController {
}
@Get("/:webhookId")
@ApiOperation({ summary: "Get a webhook of an event-type" })
@ApiOperation({ summary: "Get a webhook" })
async getEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
return {
status: SUCCESS_STATUS,
@@ -92,7 +92,7 @@ export class EventTypeWebhooksController {
}
@Get("/")
@ApiOperation({ summary: "Get all webhooks of an event-type" })
@ApiOperation({ summary: "Get all webhooks" })
async getEventTypeWebhooks(
@Param("eventTypeId", ParseIntPipe) eventTypeId: number,
@Query() pagination: SkipTakePagination
@@ -113,7 +113,7 @@ export class EventTypeWebhooksController {
}
@Delete("/:webhookId")
@ApiOperation({ summary: "Delete a webhook of an event-type" })
@ApiOperation({ summary: "Delete a webhook" })
async deleteEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
await this.webhooksService.deleteWebhook(webhook.id);
return {
@@ -125,7 +125,7 @@ export class EventTypeWebhooksController {
}
@Delete("/")
@ApiOperation({ summary: "Delete all webhooks of an event-type" })
@ApiOperation({ summary: "Delete all webhooks" })
async deleteAllEventTypeWebhooks(
@Param("eventTypeId", ParseIntPipe) eventTypeId: number
): Promise<DeleteManyWebhooksOutputResponseDto> {
@@ -28,7 +28,7 @@ import {
Query,
NotFoundException,
} from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { User } from "@prisma/client";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -39,7 +39,7 @@ import { Pagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, OAuthClientGuard)
@DocsTags("Managed users")
@DocsTags("Platform / Managed Users")
export class OAuthClientUsersController {
private readonly logger = new Logger("UserController");
@@ -51,6 +51,7 @@ export class OAuthClientUsersController {
) {}
@Get("/")
@ApiOperation({ summary: "Get all managed users" })
async getManagedUsers(
@Param("clientId") oAuthClientId: string,
@Query() queryParams: Pagination
@@ -71,6 +72,7 @@ export class OAuthClientUsersController {
}
@Post("/")
@ApiOperation({ summary: "Create a managed user" })
async createUser(
@Param("clientId") oAuthClientId: string,
@Body() body: CreateManagedUserInput
@@ -101,6 +103,7 @@ export class OAuthClientUsersController {
@Get("/:userId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Get a managed user" })
async getUserById(
@Param("clientId") clientId: string,
@Param("userId") userId: number
@@ -115,6 +118,7 @@ export class OAuthClientUsersController {
@Patch("/:userId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Update a managed user" })
async updateUser(
@Param("clientId") clientId: string,
@Param("userId") userId: number,
@@ -133,6 +137,7 @@ export class OAuthClientUsersController {
@Delete("/:userId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Delete a managed user" })
async deleteUser(
@Param("clientId") clientId: string,
@Param("userId") userId: number
@@ -150,6 +155,7 @@ export class OAuthClientUsersController {
@Post("/:userId/force-refresh")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Force refresh tokens" })
async forceRefresh(
@Param("userId") userId: number,
@Param("clientId") oAuthClientId: string
@@ -16,7 +16,7 @@ import { WebhookOutputPipe } from "@/modules/webhooks/pipes/WebhookOutputPipe";
import { OAuthClientWebhooksService } from "@/modules/webhooks/services/oauth-clients-webhooks.service";
import { WebhooksService } from "@/modules/webhooks/services/webhooks.service";
import { Controller, Post, Body, UseGuards, Get, Param, Query, Delete, Patch } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { Webhook, MembershipRole } from "@prisma/client";
import { plainToClass } from "class-transformer";
@@ -30,7 +30,7 @@ import { OAuthClientGuard } from "../../guards/oauth-client-guard";
version: API_VERSIONS_VALUES,
})
@UseGuards(NextAuthGuard, OrganizationRolesGuard, OAuthClientGuard)
@ApiTags("OAuthClients Webhooks")
@DocsTags("Platform / Webhooks")
export class OAuthClientWebhooksController {
constructor(
private readonly webhooksService: WebhooksService,
@@ -39,7 +39,7 @@ export class OAuthClientWebhooksController {
@Post("/")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER])
@ApiOperation({ summary: "Create a webhook for an oAuthClient" })
@ApiOperation({ summary: "Create a webhook" })
async createOAuthClientWebhook(
@Body() body: CreateWebhookInputDto,
@Param("clientId") oAuthClientId: string
@@ -59,7 +59,7 @@ export class OAuthClientWebhooksController {
@Patch("/:webhookId")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER])
@ApiOperation({ summary: "Update a webhook of an oAuthClient" })
@ApiOperation({ summary: "Update a webhook" })
@UseGuards(IsOAuthClientWebhookGuard)
async updateOAuthClientWebhook(
@Body() body: UpdateWebhookInputDto,
@@ -79,7 +79,7 @@ export class OAuthClientWebhooksController {
@Get("/:webhookId")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER, MembershipRole.MEMBER])
@ApiOperation({ summary: "Get a webhook of an oAuthClient" })
@ApiOperation({ summary: "Get a webhook" })
@UseGuards(IsOAuthClientWebhookGuard)
async getOAuthClientWebhook(@GetWebhook() webhook: Webhook): Promise<OAuthClientWebhookOutputResponseDto> {
return {
@@ -92,7 +92,7 @@ export class OAuthClientWebhooksController {
@Get("/")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER, MembershipRole.MEMBER])
@ApiOperation({ summary: "Get all webhooks of an oAuthClient" })
@ApiOperation({ summary: "Get all webhooks" })
async getOAuthClientWebhooks(
@Param("clientId") oAuthClientId: string,
@Query() pagination: SkipTakePagination
@@ -114,7 +114,7 @@ export class OAuthClientWebhooksController {
@Delete("/:webhookId")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER])
@ApiOperation({ summary: "Delete a webhook of an oAuthClient" })
@ApiOperation({ summary: "Delete a webhook" })
@UseGuards(IsOAuthClientWebhookGuard)
async deleteOAuthClientWebhook(
@GetWebhook() webhook: Webhook
@@ -130,7 +130,7 @@ export class OAuthClientWebhooksController {
@Delete("/")
@MembershipRoles([MembershipRole.ADMIN, MembershipRole.OWNER])
@ApiOperation({ summary: "Delete all webhooks of an oAuthClient" })
@ApiOperation({ summary: "Delete all webhooks" })
async deleteAllOAuthClientWebhooks(
@Param("clientId") oAuthClientId: string
): Promise<DeleteManyWebhooksOutputResponseDto> {
@@ -20,6 +20,7 @@ import { GetAllAttributeOptionOutput } from "@/modules/organizations/outputs/att
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 { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -28,13 +29,14 @@ import { SUCCESS_STATUS } from "@calcom/platform-constants";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Orgs / Attributes / Options")
export class OrganizationsOptionsAttributesController {
constructor(private readonly organizationsAttributesOptionsService: OrganizationAttributeOptionService) {}
// Creates an attribute option for an attribute
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Post("/attributes/:attributeId/options")
@ApiOperation({ summary: "Create an attribute option" })
async createOrganizationAttributeOption(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string,
@@ -52,10 +54,10 @@ export class OrganizationsOptionsAttributesController {
};
}
// Deletes an attribute option for an attribute
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Delete("/attributes/:attributeId/options/:optionId")
@ApiOperation({ summary: "Delete an attribute option" })
async deleteOrganizationAttributeOption(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string,
@@ -73,10 +75,10 @@ export class OrganizationsOptionsAttributesController {
};
}
// Updates an attribute option for an attribute
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Patch("/attributes/:attributeId/options/:optionId")
@ApiOperation({ summary: "Update an attribute option" })
async updateOrganizationAttributeOption(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string,
@@ -96,10 +98,10 @@ export class OrganizationsOptionsAttributesController {
};
}
// Gets all attribute options for an attribute
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
@Get("/attributes/:attributeId/options")
@ApiOperation({ summary: "Get all attribute options" })
async getOrganizationAttributeOptions(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string
@@ -114,10 +116,10 @@ export class OrganizationsOptionsAttributesController {
};
}
// Assign attribute option to user
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Post("/attributes/options/:userId")
@ApiOperation({ summary: "Assign an attribute to a user" })
async assignOrganizationAttributeOptionToUser(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("userId", ParseIntPipe) userId: number,
@@ -135,10 +137,10 @@ export class OrganizationsOptionsAttributesController {
};
}
// Unassign attribute option from user
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
@Delete("/attributes/options/:userId/:attributeOptionId")
@ApiOperation({ summary: "Unassign an attribute from a user" })
async unassignOrganizationAttributeOptionFromUser(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("userId", ParseIntPipe) userId: number,
@@ -159,6 +161,7 @@ export class OrganizationsOptionsAttributesController {
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
@Get("/attributes/options/:userId")
@ApiOperation({ summary: "Get all attribute options for a user" })
async getOrganizationAttributeOptionsForUser(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("userId", ParseIntPipe) userId: number
@@ -28,6 +28,7 @@ import {
Query,
UseGuards,
} from "@nestjs/common";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import { SkipTakePagination } from "@calcom/platform-types";
@@ -37,12 +38,14 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Orgs / Attributes")
export class OrganizationsAttributesController {
constructor(private readonly organizationsAttributesService: OrganizationAttributesService) {}
// Gets all attributes for an organization
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
@Get("/attributes")
@ApiOperation({ summary: "Get all attributes" })
async getOrganizationAttributes(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() queryParams: SkipTakePagination
@@ -60,6 +63,7 @@ export class OrganizationsAttributesController {
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
@Get("/attributes/:attributeId")
@ApiOperation({ summary: "Get an attribute" })
async getOrganizationAttribute(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string
@@ -75,6 +79,7 @@ export class OrganizationsAttributesController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Post("/attributes")
@ApiOperation({ summary: "Create an attribute" })
async createOrganizationAttribute(
@Param("orgId", ParseIntPipe) orgId: number,
@Body() bodyAttribute: CreateOrganizationAttributeInput
@@ -93,6 +98,7 @@ export class OrganizationsAttributesController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Patch("/attributes/:attributeId")
@ApiOperation({ summary: "Update an attribute" })
async updateOrganizationAttribute(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string,
@@ -113,6 +119,7 @@ export class OrganizationsAttributesController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Delete("/attributes/:attributeId")
@ApiOperation({ summary: "Delete an attribute" })
async deleteOrganizationAttribute(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("attributeId") attributeId: string
@@ -36,7 +36,7 @@ import {
NotFoundException,
Query,
} from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { ERROR_STATUS, SUCCESS_STATUS } from "@calcom/platform-constants";
import { handleCreatePhoneCall } from "@calcom/platform-libraries";
@@ -57,7 +57,7 @@ export type EventTypeHandlerResponse = {
path: "/v2/organizations/:orgId",
version: API_VERSIONS_VALUES,
})
@DocsTags("Organizations Event Types")
@DocsTags("Orgs / Event Types")
export class OrganizationsEventTypesController {
constructor(
private readonly organizationsEventTypesService: OrganizationsEventTypesService,
@@ -70,6 +70,7 @@ export class OrganizationsEventTypesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, IsTeamInOrg, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@Post("/teams/:teamId/event-types")
@ApiOperation({ summary: "Create an event type" })
async createTeamEventType(
@GetUser() user: UserWithProfile,
@Param("teamId", ParseIntPipe) teamId: number,
@@ -99,6 +100,7 @@ export class OrganizationsEventTypesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, IsTeamInOrg, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@Get("/teams/:teamId/event-types/:eventTypeId")
@ApiOperation({ summary: "Get an event type" })
async getTeamEventType(
@Param("teamId", ParseIntPipe) teamId: number,
@Param("eventTypeId") eventTypeId: number
@@ -120,6 +122,7 @@ export class OrganizationsEventTypesController {
@Roles("TEAM_ADMIN")
@Post("/teams/:teamId/event-types/:eventTypeId/create-phone-call")
@UseGuards(ApiAuthGuard, IsOrgGuard, IsTeamInOrg, RolesGuard)
@ApiOperation({ summary: "Create a phone call" })
async createPhoneCall(
@Param("eventTypeId") eventTypeId: number,
@Param("orgId", ParseIntPipe) orgId: number,
@@ -143,6 +146,7 @@ export class OrganizationsEventTypesController {
@UseGuards(IsOrgGuard, IsTeamInOrg, IsAdminAPIEnabledGuard)
@Get("/teams/:teamId/event-types")
@ApiOperation({ summary: "Get a team event type" })
async getTeamEventTypes(
@Param("teamId", ParseIntPipe) teamId: number,
@Query() queryParams: GetTeamEventTypesQuery_2024_06_14
@@ -170,6 +174,7 @@ export class OrganizationsEventTypesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@Get("/teams/event-types")
@ApiOperation({ summary: "Get all team event types" })
async getTeamsEventTypes(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() queryParams: SkipTakePagination
@@ -187,6 +192,7 @@ export class OrganizationsEventTypesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, IsTeamInOrg, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@Patch("/teams/:teamId/event-types/:eventTypeId")
@ApiOperation({ summary: "Update a team event type" })
async updateTeamEventType(
@Param("teamId", ParseIntPipe) teamId: number,
@Param("eventTypeId", ParseIntPipe) eventTypeId: number,
@@ -218,6 +224,7 @@ export class OrganizationsEventTypesController {
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, IsTeamInOrg, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@Delete("/teams/:teamId/event-types/:eventTypeId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Delete a team event type" })
async deleteTeamEventType(
@Param("teamId", ParseIntPipe) teamId: number,
@Param("eventTypeId", ParseIntPipe) eventTypeId: number
@@ -30,7 +30,7 @@ import {
HttpCode,
HttpStatus,
} from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -41,7 +41,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Organizations Memberships")
@DocsTags("Orgs / Memberships")
export class OrganizationsMembershipsController {
constructor(private organizationsMembershipService: OrganizationsMembershipService) {}
@@ -49,6 +49,7 @@ export class OrganizationsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Get("/")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Get all memberships" })
async getAllMemberships(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() queryParams: SkipTakePagination
@@ -71,6 +72,7 @@ export class OrganizationsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Post("/")
@HttpCode(HttpStatus.CREATED)
@ApiOperation({ summary: "Create a membership" })
async createMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Body() body: CreateOrgMembershipDto
@@ -87,6 +89,7 @@ export class OrganizationsMembershipsController {
@UseGuards(IsMembershipInOrg)
@Get("/:membershipId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Get a membership" })
async getOrgMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("membershipId", ParseIntPipe) membershipId: number
@@ -103,6 +106,7 @@ export class OrganizationsMembershipsController {
@UseGuards(IsMembershipInOrg)
@Delete("/:membershipId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Delete a membership" })
async deleteMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("membershipId", ParseIntPipe) membershipId: number
@@ -119,6 +123,7 @@ export class OrganizationsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Patch("/:membershipId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Update a membership" })
async updateMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("membershipId", ParseIntPipe) membershipId: number,
@@ -23,7 +23,7 @@ import {
HttpStatus,
Query,
} from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import {
@@ -42,7 +42,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Organizations Schedules")
@DocsTags("Orgs / Schedules")
export class OrganizationsSchedulesController {
constructor(
private schedulesService: SchedulesService_2024_06_11,
@@ -52,6 +52,7 @@ export class OrganizationsSchedulesController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Get("/schedules")
@ApiOperation({ summary: "Get all schedules" })
async getOrganizationSchedules(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() queryParams: SkipTakePagination
@@ -70,6 +71,8 @@ export class OrganizationsSchedulesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@Post("/users/:userId/schedules")
@DocsTags("Orgs / Users / Schedules")
@ApiOperation({ summary: "Create a schedule" })
async createUserSchedule(
@Param("userId", ParseIntPipe) userId: number,
@Body() bodySchedule: CreateScheduleInput_2024_06_11
@@ -86,6 +89,8 @@ export class OrganizationsSchedulesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@Get("/users/:userId/schedules/:scheduleId")
@DocsTags("Orgs / Users / Schedules")
@ApiOperation({ summary: "Get a schedule" })
async getUserSchedule(
@Param("userId", ParseIntPipe) userId: number,
@Param("scheduleId") scheduleId: number
@@ -102,6 +107,8 @@ export class OrganizationsSchedulesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@Get("/users/:userId/schedules")
@DocsTags("Orgs / Users / Schedules")
@ApiOperation({ summary: "Get all schedules" })
async getUserSchedules(
@Param("userId", ParseIntPipe) userId: number
): Promise<GetSchedulesOutput_2024_06_11> {
@@ -117,6 +124,8 @@ export class OrganizationsSchedulesController {
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@Patch("/users/:userId/schedules/:scheduleId")
@DocsTags("Orgs / Users / Schedules")
@ApiOperation({ summary: "Update a schedule" })
async updateUserSchedule(
@Param("userId", ParseIntPipe) userId: number,
@Param("scheduleId", ParseIntPipe) scheduleId: number,
@@ -135,6 +144,8 @@ export class OrganizationsSchedulesController {
@UseGuards(IsUserInOrg)
@Delete("/users/:userId/schedules/:scheduleId")
@HttpCode(HttpStatus.OK)
@DocsTags("Orgs / Users / Schedules")
@ApiOperation({ summary: "Delete a schedule" })
async deleteUserSchedule(
@Param("userId", ParseIntPipe) userId: number,
@Param("scheduleId", ParseIntPipe) scheduleId: number
@@ -42,7 +42,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, IsTeamInOrg, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Organizations Teams")
@DocsTags("Orgs / Teams / Memberships")
export class OrganizationsTeamsMembershipsController {
constructor(
private organizationsTeamsMembershipsService: OrganizationsTeamsMembershipsService,
@@ -50,7 +50,7 @@ export class OrganizationsTeamsMembershipsController {
) {}
@Get("/")
@ApiOperation({ summary: "Get all the memberships of a team of an organization." })
@ApiOperation({ summary: "Get all memberships" })
@UseGuards()
@Roles("TEAM_ADMIN")
@PlatformPlan("ESSENTIALS")
@@ -76,7 +76,7 @@ export class OrganizationsTeamsMembershipsController {
}
@Get("/:membershipId")
@ApiOperation({ summary: "Get the membership of an organization's team by ID" })
@ApiOperation({ summary: "Get a membership" })
@UseGuards()
@Roles("TEAM_ADMIN")
@PlatformPlan("ESSENTIALS")
@@ -101,7 +101,7 @@ export class OrganizationsTeamsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Delete("/:membershipId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Delete the membership of an organization's team by ID" })
@ApiOperation({ summary: "Delete a membership" })
async deleteOrgTeamMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("teamId", ParseIntPipe) teamId: number,
@@ -122,7 +122,7 @@ export class OrganizationsTeamsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Patch("/:membershipId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Update the membership of an organization's team by ID" })
@ApiOperation({ summary: "Update a membership" })
async updateOrgTeamMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("teamId", ParseIntPipe) teamId: number,
@@ -145,7 +145,7 @@ export class OrganizationsTeamsMembershipsController {
@PlatformPlan("ESSENTIALS")
@Post("/")
@HttpCode(HttpStatus.CREATED)
@ApiOperation({ summary: "Create a membership of an organization's team" })
@ApiOperation({ summary: "Create a membership" })
async createOrgTeamMembership(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("teamId", ParseIntPipe) teamId: number,
@@ -45,12 +45,13 @@ import { Team } from "@calcom/prisma/client";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Organizations Teams")
@DocsTags("Orgs / Teams")
export class OrganizationsTeamsController {
constructor(private organizationsTeamsService: OrganizationsTeamsService) {}
@Get()
@ApiOperation({ summary: "Get all the teams of an organization." })
@DocsTags("Teams")
@ApiOperation({ summary: "Get all teams" })
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
async getAllTeams(
@@ -66,7 +67,7 @@ export class OrganizationsTeamsController {
}
@Get("/me")
@ApiOperation({ summary: "Get the organization's teams user is a member of" })
@ApiOperation({ summary: "Get team membership for user" })
@Roles("ORG_MEMBER")
@PlatformPlan("ESSENTIALS")
async getMyTeams(
@@ -97,7 +98,7 @@ export class OrganizationsTeamsController {
@Roles("TEAM_ADMIN")
@PlatformPlan("ESSENTIALS")
@Get("/:teamId")
@ApiOperation({ summary: "Get a team of the organization by ID." })
@ApiOperation({ summary: "Get a team" })
async getTeam(@GetTeam() team: Team): Promise<OrgTeamOutputResponseDto> {
return {
status: SUCCESS_STATUS,
@@ -109,7 +110,7 @@ export class OrganizationsTeamsController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Delete("/:teamId")
@ApiOperation({ summary: "Delete a team of the organization by ID." })
@ApiOperation({ summary: "Delete a team" })
async deleteTeam(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("teamId", ParseIntPipe) teamId: number
@@ -125,7 +126,7 @@ export class OrganizationsTeamsController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@Patch("/:teamId")
@ApiOperation({ summary: "Update a team of the organization by ID." })
@ApiOperation({ summary: "Update a team" })
async updateTeam(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("teamId", ParseIntPipe) teamId: number,
@@ -141,7 +142,7 @@ export class OrganizationsTeamsController {
@Post()
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@ApiOperation({ summary: "Create a team for an organization." })
@ApiOperation({ summary: "Create a team" })
async createTeam(
@Param("orgId", ParseIntPipe) orgId: number,
@Body() body: CreateOrgTeamDto,
@@ -31,7 +31,7 @@ import {
Query,
} from "@nestjs/common";
import { ClassSerializerInterceptor } from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToInstance } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -44,13 +44,14 @@ import { Team } from "@calcom/prisma/client";
@UseInterceptors(ClassSerializerInterceptor)
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@UseGuards(IsOrgGuard)
@DocsTags("Organizations Users")
@DocsTags("Orgs / Users")
export class OrganizationsUsersController {
constructor(private readonly organizationsUsersService: OrganizationsUsersService) {}
@Get()
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@ApiOperation({ summary: "Get all users" })
async getOrganizationsUsers(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() query: GetOrganizationsUsersInput
@@ -71,6 +72,7 @@ export class OrganizationsUsersController {
@Post()
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@ApiOperation({ summary: "Create a user" })
async createOrganizationUser(
@Param("orgId", ParseIntPipe) orgId: number,
@GetOrg() org: Team,
@@ -92,6 +94,7 @@ export class OrganizationsUsersController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@ApiOperation({ summary: "Update a user" })
async updateOrganizationUser(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("userId", ParseIntPipe) userId: number,
@@ -109,6 +112,7 @@ export class OrganizationsUsersController {
@Roles("ORG_ADMIN")
@PlatformPlan("ESSENTIALS")
@UseGuards(IsUserInOrg)
@ApiOperation({ summary: "Delete a user" })
async deleteOrganizationUser(
@Param("orgId", ParseIntPipe) orgId: number,
@Param("userId", ParseIntPipe) userId: number
@@ -32,7 +32,7 @@ import {
HttpCode,
HttpStatus,
} from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -43,7 +43,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard, IsOrgGuard, RolesGuard, PlatformPlanGuard, IsAdminAPIEnabledGuard)
@DocsTags("Organizations Webhooks")
@DocsTags("Orgs / Webhooks")
export class OrganizationsWebhooksController {
constructor(
private organizationsWebhooksService: OrganizationsWebhooksService,
@@ -54,6 +54,7 @@ export class OrganizationsWebhooksController {
@PlatformPlan("ESSENTIALS")
@Get("/")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Get all webhooks" })
async getAllOrganizationWebhooks(
@Param("orgId", ParseIntPipe) orgId: number,
@Query() queryParams: SkipTakePagination
@@ -78,6 +79,7 @@ export class OrganizationsWebhooksController {
@PlatformPlan("ESSENTIALS")
@Post("/")
@HttpCode(HttpStatus.CREATED)
@ApiOperation({ summary: "Create a webhook" })
async createOrganizationWebhook(
@Param("orgId", ParseIntPipe) orgId: number,
@Body() body: CreateWebhookInputDto
@@ -99,6 +101,7 @@ export class OrganizationsWebhooksController {
@UseGuards(IsWebhookInOrg)
@Get("/:webhookId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Get a webhook" })
async getOrganizationWebhook(@Param("webhookId") webhookId: string): Promise<OrgWebhookOutputResponseDto> {
const webhook = await this.organizationsWebhooksService.getWebhook(webhookId);
return {
@@ -114,6 +117,7 @@ export class OrganizationsWebhooksController {
@UseGuards(IsWebhookInOrg)
@Delete("/:webhookId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Delete a webhook" })
async deleteWebhook(@Param("webhookId") webhookId: string): Promise<OrgWebhookOutputResponseDto> {
const webhook = await this.webhooksService.deleteWebhook(webhookId);
return {
@@ -129,6 +133,7 @@ export class OrganizationsWebhooksController {
@UseGuards(IsWebhookInOrg)
@Patch("/:webhookId")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: "Update a webhook" })
async updateOrgWebhook(
@Param("webhookId") webhookId: string,
@Body() body: UpdateWebhookInputDto
@@ -14,7 +14,7 @@ import {
import { SelectedCalendarsRepository } from "@/modules/selected-calendars/selected-calendars.repository";
import { UserWithProfile } from "@/modules/users/users.repository";
import { Body, Controller, Post, UseGuards, Delete, Query } from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { plainToClass } from "class-transformer";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -23,7 +23,7 @@ import { SUCCESS_STATUS } from "@calcom/platform-constants";
path: "/v2/selected-calendars",
version: API_VERSIONS_VALUES,
})
@DocsTags("Selected-Calendars")
@DocsTags("Selected Calendars")
export class SelectedCalendarsController {
constructor(
private readonly calendarsRepository: CalendarsRepository,
@@ -33,6 +33,7 @@ export class SelectedCalendarsController {
@Post("/")
@UseGuards(ApiAuthGuard)
@ApiOperation({ summary: "Add a selected calendar" })
async addSelectedCalendar(
@Body() input: SelectedCalendarsInputDto,
@GetUser() user: UserWithProfile
@@ -55,6 +56,7 @@ export class SelectedCalendarsController {
@Delete("/")
@UseGuards(ApiAuthGuard)
@ApiOperation({ summary: "Delete a selected calendar" })
async removeSelectedCalendar(
@Query() queryParams: SelectedCalendarsQueryParamsInputDto,
@GetUser() user: UserWithProfile
@@ -1,7 +1,7 @@
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
import { SlotsService } from "@/modules/slots/services/slots.service";
import { Query, Body, Controller, Get, Delete, Post, Req, Res } from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { Response as ExpressResponse, Request as ExpressRequest } from "express";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
@@ -19,6 +19,7 @@ export class SlotsController {
constructor(private readonly slotsService: SlotsService) {}
@Post("/reserve")
@ApiOperation({ summary: "Reserve a slot" })
async reserveSlot(
@Body() body: ReserveSlotInput,
@Res({ passthrough: true }) res: ExpressResponse,
@@ -34,6 +35,7 @@ export class SlotsController {
}
@Delete("/selected-slot")
@ApiOperation({ summary: "Delete a selected slot" })
async deleteSelectedSlot(
@Query() params: RemoveSelectedSlotInput,
@Req() req: ExpressRequest
@@ -48,6 +50,7 @@ export class SlotsController {
}
@Get("/available")
@ApiOperation({ summary: "Get available slots" })
async getAvailableSlots(
@Query() query: GetAvailableSlotsInput,
@Req() req: ExpressRequest
@@ -1,7 +1,7 @@
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
import { TimezonesService } from "@/modules/timezones/services/timezones.service";
import { Controller, Get } from "@nestjs/common";
import { ApiTags as DocsTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { SUCCESS_STATUS } from "@calcom/platform-constants";
import type { CityTimezones } from "@calcom/platform-libraries";
@@ -16,6 +16,7 @@ export class TimezonesController {
constructor(private readonly timezonesService: TimezonesService) {}
@Get("/")
@ApiOperation({ summary: "Get all timezones" })
async getTimeZones(): Promise<ApiResponse<CityTimezones>> {
const timeZones = await this.timezonesService.getCityTimeZones();
@@ -15,7 +15,7 @@ import { WebhookOutputPipe } from "@/modules/webhooks/pipes/WebhookOutputPipe";
import { UserWebhooksService } from "@/modules/webhooks/services/user-webhooks.service";
import { WebhooksService } from "@/modules/webhooks/services/webhooks.service";
import { Controller, Post, Body, UseGuards, Get, Param, Query, Delete, Patch } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
import { Webhook } from "@prisma/client";
import { plainToClass } from "class-transformer";
@@ -27,7 +27,7 @@ import { SkipTakePagination } from "@calcom/platform-types";
version: API_VERSIONS_VALUES,
})
@UseGuards(ApiAuthGuard)
@ApiTags("Users' Webhooks")
@DocsTags("Webhooks")
export class WebhooksController {
constructor(
private readonly webhooksService: WebhooksService,
@@ -82,7 +82,7 @@ export class WebhooksController {
}
@Get("/")
@ApiOperation({ summary: "Get all user webhooks paginated" })
@ApiOperation({ summary: "Get all webooks (paginated)" })
async getWebhooks(
@GetUser() user: UserWithProfile,
@Query() query: SkipTakePagination