Skip to content

Commit

Permalink
fix(api): remove openApi Methods (#7128)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco authored Nov 25, 2024
1 parent f33b165 commit 6b584cd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions apps/api/src/app/change/changes.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Body, ClassSerializerInterceptor, Controller, Get, Param, Post, Query, UseInterceptors } from '@nestjs/common';
import { ApiRateLimitCostEnum, UserSessionData } from '@novu/shared';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { ApplyChange, ApplyChangeCommand } from './usecases';
import { GetChanges } from './usecases/get-changes/get-changes.usecase';
Expand All @@ -24,6 +25,7 @@ import { SdkMethodName } from '../shared/framework/swagger/sdk.decorators';
@UseInterceptors(ClassSerializerInterceptor)
@UserAuthentication()
@ApiTags('Changes')
@ApiExcludeController()
export class ChangesController {
constructor(
private applyChange: ApplyChange,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/environments-v2/environments.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ClassSerializerInterceptor, Controller, Get, Param, UseInterceptors } from '@nestjs/common';
import { UserSessionData } from '@novu/shared';
import { ApiTags } from '@nestjs/swagger';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { GetEnvironmentTags, GetEnvironmentTagsCommand } from './usecases/get-environment-tags';
import { ExternalApiAccessible } from '../auth/framework/external-api.decorator';
Expand All @@ -13,6 +14,7 @@ import { GetEnvironmentTagsDto } from './dtos/get-environment-tags.dto';
@UseInterceptors(ClassSerializerInterceptor)
@UserAuthentication()
@ApiTags('Environments')
@ApiExcludeController()
export class EnvironmentsController {
constructor(private getEnvironmentTagsUsecase: GetEnvironmentTags) {}

Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/feeds/feeds.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@nestjs/common';
import { UserSessionData } from '@novu/shared';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { CreateFeed } from './usecases/create-feed/create-feed.usecase';
import { CreateFeedCommand } from './usecases/create-feed/create-feed.command';
Expand All @@ -28,6 +29,7 @@ import { UserAuthentication } from '../shared/framework/swagger/api.key.security
@UseInterceptors(ClassSerializerInterceptor)
@UserAuthentication()
@ApiTags('Feeds')
@ApiExcludeController()
export class FeedsController {
constructor(
private createFeedUsecase: CreateFeed,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/layouts/layouts.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
import { OrderByEnum, OrderDirectionEnum, UserSessionData } from '@novu/shared';
import { GetLayoutCommand, GetLayoutUseCase, OtelSpan } from '@novu/application-generic';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import {
ApiBadRequestResponse,
ApiCommonResponses,
Expand Down Expand Up @@ -56,6 +57,7 @@ import { SdkMethodName } from '../shared/framework/swagger/sdk.decorators';
@Controller('/layouts')
@ApiTags('Layouts')
@UserAuthentication()
@ApiExcludeController()
export class LayoutsController {
constructor(
private createLayoutUseCase: CreateLayoutUseCase,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/organization/organization.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { OrganizationEntity } from '@novu/dal';
import { MemberRoleEnum, UserSessionData } from '@novu/shared';
import { ApiExcludeEndpoint, ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { CreateOrganizationDto } from './dtos/create-organization.dto';
import { CreateOrganizationCommand } from './usecases/create-organization/create-organization.command';
Expand Down Expand Up @@ -48,6 +49,7 @@ import { SdkGroupName, SdkMethodName } from '../shared/framework/swagger/sdk.dec
@UserAuthentication()
@ApiTags('Organizations')
@ApiCommonResponses()
@ApiExcludeController()
export class OrganizationController {
constructor(
private createOrganizationUsecase: CreateOrganization,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsDefined, IsObject, IsOptional, IsString } from 'class-validator';
import { IsDefined, IsEnum, IsObject, IsOptional, IsString } from 'class-validator';
import { ChatProviderIdEnum, ISubscriberChannel, PushProviderIdEnum } from '@novu/shared';

import { ChannelCredentials } from '../../shared/dtos/subscriber-channel';

export function getEnumValues<T>(enumObj: T): Array<T[keyof T]> {
return Object.values(enumObj || {}) as Array<T[keyof T]>;
}
export class UpdateSubscriberChannelRequestDto implements ISubscriberChannel {
@ApiProperty({
enum: [ChatProviderIdEnum, PushProviderIdEnum],
enum: [...getEnumValues(ChatProviderIdEnum), ...getEnumValues(PushProviderIdEnum)],
description: 'The provider identifier for the credentials',
})
@IsString()
@IsEnum(
{ ...ChatProviderIdEnum, ...PushProviderIdEnum },
{
message: 'providerId must be a valid provider ID',
}
)
@IsDefined()
providerId: ChatProviderIdEnum | PushProviderIdEnum;

Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/tenant/tenant.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
UpdateTenant,
UpdateTenantCommand,
} from '@novu/application-generic';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { ExternalApiAccessible } from '../auth/framework/external-api.decorator';
import {
Expand Down Expand Up @@ -62,6 +63,7 @@ const v2TenantsApiDescription = ' Tenants is not supported in code first version
@ApiTags('Tenants')
@UseInterceptors(ClassSerializerInterceptor)
@UserAuthentication()
@ApiExcludeController()
export class TenantController {
constructor(
private createTenantUsecase: CreateTenant,
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/app/workflows-v1/workflow-v1.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from '@novu/shared';

import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiExcludeController } from '@nestjs/swagger/dist/decorators/api-exclude-controller.decorator';
import { UserSession } from '../shared/framework/user.decorator';
import { GetNotificationTemplates } from './usecases/get-notification-templates/get-notification-templates.usecase';
import { GetNotificationTemplatesCommand } from './usecases/get-notification-templates/get-notification-templates.command';
Expand All @@ -45,7 +46,7 @@ import { WorkflowResponse } from './dto/workflow-response.dto';
import { WorkflowsResponseDto } from './dto/workflows.response.dto';
import { ExternalApiAccessible } from '../auth/framework/external-api.decorator';
import { WorkflowsRequestDto } from './dto/workflows-request.dto';
import { ApiCommonResponses, ApiOkResponse, ApiResponse } from '../shared/framework/response.decorator';
import { ApiOkResponse, ApiResponse } from '../shared/framework/response.decorator';
import { DataBooleanDto } from '../shared/dtos/data-wrapper-dto';
import { CreateWorkflowQuery } from './queries';
import { DeleteNotificationTemplateCommand } from './usecases/delete-notification-template/delete-notification-template.command';
Expand All @@ -57,7 +58,7 @@ import { SdkGroupName } from '../shared/framework/swagger/sdk.decorators';
/**
* @deprecated use controllers in /workflows directory
*/
@ApiCommonResponses()
@ApiExcludeController()
@Controller('/workflows')
@UseInterceptors(ClassSerializerInterceptor)
@UserAuthentication()
Expand Down

0 comments on commit 6b584cd

Please sign in to comment.