@@ -10,15 +10,15 @@ import {
10
10
UseGuards ,
11
11
UseInterceptors ,
12
12
} from '@nestjs/common' ;
13
- import { ApiExcludeController , ApiExcludeEndpoint , ApiOperation , ApiParam , ApiTags } from '@nestjs/swagger' ;
13
+ import { ApiExcludeEndpoint , ApiOperation , ApiParam , ApiTags } from '@nestjs/swagger' ;
14
14
import { Roles } from '@novu/application-generic' ;
15
15
import { ApiAuthSchemeEnum , MemberRoleEnum , ProductFeatureKeyEnum , UserSessionData } from '@novu/shared' ;
16
16
import { ExternalApiAccessible } from '../auth/framework/external-api.decorator' ;
17
17
import { ProductFeature } from '../shared/decorators/product-feature.decorator' ;
18
18
import { ApiKey } from '../shared/dtos/api-key' ;
19
19
import { ApiCommonResponses , ApiResponse } from '../shared/framework/response.decorator' ;
20
20
import { UserAuthentication } from '../shared/framework/swagger/api.key.security' ;
21
- import { SdkGroupName } from '../shared/framework/swagger/sdk.decorators' ;
21
+ import { SdkGroupName , SdkMethodName } from '../shared/framework/swagger/sdk.decorators' ;
22
22
import { UserSession } from '../shared/framework/user.decorator' ;
23
23
import { CreateEnvironmentRequestDto } from './dtos/create-environment-request.dto' ;
24
24
import { EnvironmentResponseDto } from './dtos/environment-response.dto' ;
@@ -36,6 +36,7 @@ import { RegenerateApiKeys } from './usecases/regenerate-api-keys/regenerate-api
36
36
import { UpdateEnvironmentCommand } from './usecases/update-environment/update-environment.command' ;
37
37
import { UpdateEnvironment } from './usecases/update-environment/update-environment.usecase' ;
38
38
import { RolesGuard } from '../auth/framework/roles.guard' ;
39
+ import { ErrorDto } from '../../error-dto' ;
39
40
40
41
/**
41
42
* @deprecated use EnvironmentsControllerV2
@@ -45,7 +46,6 @@ import { RolesGuard } from '../auth/framework/roles.guard';
45
46
@UseInterceptors ( ClassSerializerInterceptor )
46
47
@UserAuthentication ( )
47
48
@ApiTags ( 'Environments' )
48
- @ApiExcludeController ( )
49
49
export class EnvironmentsControllerV1 {
50
50
constructor (
51
51
private createEnvironmentUsecase : CreateEnvironment ,
@@ -63,6 +63,7 @@ export class EnvironmentsControllerV1 {
63
63
} )
64
64
@ApiResponse ( EnvironmentResponseDto )
65
65
@ExternalApiAccessible ( )
66
+ @ApiExcludeEndpoint ( )
66
67
async getCurrentEnvironment ( @UserSession ( ) user : UserSessionData ) : Promise < EnvironmentResponseDto > {
67
68
return await this . getEnvironmentUsecase . execute (
68
69
GetEnvironmentCommand . create ( {
@@ -77,11 +78,13 @@ export class EnvironmentsControllerV1 {
77
78
@ApiOperation ( {
78
79
summary : 'Create environment' ,
79
80
} )
80
- @ApiExcludeEndpoint ( )
81
81
@ApiResponse ( EnvironmentResponseDto , 201 )
82
+ @ApiResponse ( ErrorDto , 402 , false , false )
82
83
@ProductFeature ( ProductFeatureKeyEnum . MANAGE_ENVIRONMENTS )
83
84
@UseGuards ( RolesGuard )
84
85
@Roles ( MemberRoleEnum . ADMIN )
86
+ @SdkGroupName ( 'Environments' )
87
+ @SdkMethodName ( 'create' )
85
88
async createEnvironment (
86
89
@UserSession ( ) user : UserSessionData ,
87
90
@Body ( ) body : CreateEnvironmentRequestDto
@@ -103,6 +106,7 @@ export class EnvironmentsControllerV1 {
103
106
} )
104
107
@ApiResponse ( EnvironmentResponseDto , 200 , true )
105
108
@ExternalApiAccessible ( )
109
+ @ApiExcludeEndpoint ( )
106
110
async listMyEnvironments ( @UserSession ( ) user : UserSessionData ) : Promise < EnvironmentResponseDto [ ] > {
107
111
return await this . getMyEnvironmentsUsecase . execute (
108
112
GetMyEnvironmentsCommand . create ( {
@@ -146,6 +150,7 @@ export class EnvironmentsControllerV1 {
146
150
@ApiResponse ( ApiKey , 200 , true )
147
151
@ExternalApiAccessible ( )
148
152
@SdkGroupName ( 'Environments.ApiKeys' )
153
+ @ApiExcludeEndpoint ( )
149
154
async listOrganizationApiKeys ( @UserSession ( ) user : UserSessionData ) : Promise < ApiKey [ ] > {
150
155
const command = GetApiKeysCommand . create ( {
151
156
userId : user . _id ,
@@ -160,6 +165,7 @@ export class EnvironmentsControllerV1 {
160
165
@ApiResponse ( ApiKey , 201 , true )
161
166
@UseGuards ( RolesGuard )
162
167
@Roles ( MemberRoleEnum . ADMIN )
168
+ @ApiExcludeEndpoint ( )
163
169
async regenerateOrganizationApiKeys ( @UserSession ( ) user : UserSessionData ) : Promise < ApiKey [ ] > {
164
170
const command = GetApiKeysCommand . create ( {
165
171
userId : user . _id ,
@@ -178,6 +184,7 @@ export class EnvironmentsControllerV1 {
178
184
@ProductFeature ( ProductFeatureKeyEnum . MANAGE_ENVIRONMENTS )
179
185
@UseGuards ( RolesGuard )
180
186
@Roles ( MemberRoleEnum . ADMIN )
187
+ @ApiExcludeEndpoint ( )
181
188
async deleteEnvironment ( @UserSession ( ) user : UserSessionData , @Param ( 'environmentId' ) environmentId : string ) {
182
189
return await this . deleteEnvironmentUsecase . execute (
183
190
DeleteEnvironmentCommand . create ( {
0 commit comments