fix: API v2 @GetWebhook() decorator doesn't generate OpenAPI path (#27612)
* fix: openapi spec for GetWebhook decorator * fix: openapi spec
This commit is contained in:
1 parent
d8e6ecc7a0
commit
db76980644
6 files changed
+142
-5
No files matched your search
@@ -26,7 +26,7 @@ import {
|
||||
Patch,
|
||||
ParseIntPipe,
|
||||
} from "@nestjs/common";
|
||||
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { plainToClass } from "class-transformer";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -84,6 +84,7 @@ export class EventTypeWebhooksController {
|
||||
|
||||
@Get("/:webhookId")
|
||||
@ApiOperation({ summary: "Get a webhook" })
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
async getEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
|
||||
return {
|
||||
status: SUCCESS_STATUS,
|
||||
@@ -116,6 +117,7 @@ export class EventTypeWebhooksController {
|
||||
|
||||
@Delete("/:webhookId")
|
||||
@ApiOperation({ summary: "Delete a webhook" })
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
async deleteEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
|
||||
await this.webhooksService.deleteWebhook(webhook.id);
|
||||
return {
|
||||
|
||||
+3
-1
@@ -3,7 +3,7 @@ import { MembershipRole } from "@calcom/platform-libraries";
|
||||
import { SkipTakePagination } from "@calcom/platform-types";
|
||||
import type { Webhook } from "@calcom/prisma/client";
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Query, UseGuards } from "@nestjs/common";
|
||||
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { plainToClass } from "class-transformer";
|
||||
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
|
||||
import { MembershipRoles } from "@/modules/auth/decorators/roles/membership-roles.decorator";
|
||||
@@ -94,6 +94,7 @@ export class OAuthClientWebhooksController {
|
||||
summary: "Get a webhook",
|
||||
description: `<Warning>These endpoints are deprecated and will be removed in the future.</Warning>`,
|
||||
})
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
@UseGuards(IsOAuthClientWebhookGuard)
|
||||
async getOAuthClientWebhook(@GetWebhook() webhook: Webhook): Promise<OAuthClientWebhookOutputResponseDto> {
|
||||
return {
|
||||
@@ -135,6 +136,7 @@ export class OAuthClientWebhooksController {
|
||||
summary: "Delete a webhook",
|
||||
description: `<Warning>These endpoints are deprecated and will be removed in the future.</Warning>`,
|
||||
})
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
@UseGuards(IsOAuthClientWebhookGuard)
|
||||
async deleteOAuthClientWebhook(
|
||||
@GetWebhook() webhook: Webhook
|
||||
|
||||
+3
-1
@@ -13,7 +13,7 @@ import {
|
||||
Query,
|
||||
UseGuards,
|
||||
} from "@nestjs/common";
|
||||
import { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { plainToClass } from "class-transformer";
|
||||
import { API_VERSIONS_VALUES } from "@/lib/api-versions";
|
||||
import { API_KEY_HEADER } from "@/lib/docs/headers";
|
||||
@@ -87,6 +87,7 @@ export class TeamsEventTypesWebhooksController {
|
||||
|
||||
@Get("/:webhookId")
|
||||
@ApiOperation({ summary: "Get a webhook for a team event type" })
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
@Roles("TEAM_MEMBER")
|
||||
async getTeamEventTypeWebhook(@GetWebhook() webhook: Webhook): Promise<EventTypeWebhookOutputResponseDto> {
|
||||
return {
|
||||
@@ -122,6 +123,7 @@ export class TeamsEventTypesWebhooksController {
|
||||
@Delete("/:webhookId")
|
||||
@Roles("TEAM_ADMIN")
|
||||
@ApiOperation({ summary: "Delete a webhook for a team event type" })
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
async deleteTeamEventTypeWebhook(
|
||||
@GetWebhook() webhook: Webhook
|
||||
): Promise<EventTypeWebhookOutputResponseDto> {
|
||||
|
||||
@@ -16,7 +16,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 { ApiHeader, ApiOperation, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { ApiHeader, ApiOperation, ApiParam, ApiTags as DocsTags } from "@nestjs/swagger";
|
||||
import { plainToClass } from "class-transformer";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -75,6 +75,7 @@ export class WebhooksController {
|
||||
|
||||
@Get("/:webhookId")
|
||||
@ApiOperation({ summary: "Get a webhook" })
|
||||
@ApiParam({ name: "webhookId", type: String, required: true })
|
||||
@UseGuards(IsUserWebhookGuard)
|
||||
async getWebhook(@GetWebhook() webhook: Webhook): Promise<UserWebhookOutputResponseDto> {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user