New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: organization apis are accessible through api key #4619
Conversation
NV-3033 make organization-related apis public
Organisations APIs are excluded from swagger and can't be accessed using API key |
NV-1920 remove @ApiExcludeController from organisation controller
Remove ApiExcludeController from organisation controller so that organisation apis are shown in api documentation. Tasks:-
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look like awesome work :)
I left a couple of comments for your review.
|
||
@IsString() | ||
@IsOptional() | ||
logo?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add here @ApiPropertyOptional()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ✅
@@ -81,6 +93,11 @@ export class OrganizationController { | |||
} | |||
|
|||
@Get('/me') | |||
@ExternalApiAccessible() | |||
@ApiResponse(OrganizationResponseDto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add?
@ApiResponse(OrganizationResponseDto) | |
@ApiResponse(OrganizationResponseDto, 200) |
@ApiOperation({ | ||
summary: 'Update a member role to admin', | ||
}) | ||
@ApiParam({ name: 'memberId', type: String, required: true }) | ||
async updateMemberRoles( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add here?
@ApiResponse(MemberDto, 200)
@ExternalApiAccessible() | ||
@ApiOperation({ | ||
summary: 'Fetch all members of current organizations', | ||
}) | ||
async getMember(@UserSession() user: IJwtPayload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add here?
@ApiResponse(MemberDto, 200, true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added MemberDto ✅
@@ -130,19 +161,12 @@ export class OrganizationController { | |||
); | |||
} | |||
|
|||
@Post('/members/invite') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what this endpoint was responsible of but i guess we don't need @post('/members/invite') that returns members. 👏
@Put('/branding') | ||
@ExternalApiAccessible() | ||
@ApiResponse(OrganizationBrandingResponseDto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be with 200?
@ApiResponse(OrganizationBrandingResponseDto) | |
@ApiResponse(OrganizationBrandingResponseDto, 200) |
@Roles(MemberRoleEnum.ADMIN) | ||
@ApiResponse(RenameOrganizationDto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be with 200?
@ApiResponse(RenameOrganizationDto) | |
@ApiResponse(RenameOrganizationDto, 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiResponse() has 200 as default status code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, good to know :)
packages/node/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
@djabarovgeorge Please look into this PR again 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah looks good to me, left a couple of comments related to class-validator and nestjs/swagger decorators.
To be honest, I don't even know if we need class-validator decorators in the DTO because we don't validate them, it could be a good idea to add validation IMO but from what i know we still don't.
invitationDate: Date; | ||
|
||
@ApiProperty() | ||
@IsDate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsDate() | |
@IsDate() | |
@ApiPropertyOptional() |
answerDate?: Date; | ||
|
||
@ApiProperty() | ||
@IsDate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsDate() | |
@IsString() |
enum: MemberRoleEnum, | ||
isArray: true, | ||
}) | ||
@IsArray() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsArray() | |
@IsEnum(MemberRoleEnum) |
@ApiPropertyOptional({ | ||
enum: { ...MemberStatusEnum }, | ||
}) | ||
@IsString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsString() | |
@IsEnum(MemberStatusEnum) |
import { UpdateBrandingDetailsDto } from './update-branding-details.dto'; | ||
|
||
export class IPartnerConfigurationResponseDto { | ||
@ApiPropertyOptional() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiPropertyOptional() | |
@ApiPropertyOptional() | |
@IsArray() | |
@IsString({ each: true }) |
@ApiProperty() | ||
accessToken: string; | ||
|
||
@ApiProperty() | ||
configurationId: string; | ||
|
||
@ApiPropertyOptional() | ||
teamId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsString()
enum: { ...PartnerTypeEnum }, | ||
description: 'Partner Type Enum', | ||
}) | ||
@IsString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IsString() | |
@IsEnum(PartnerTypeEnum) |
@IsObject() | ||
branding: OrganizationBrandingResponseDto; | ||
|
||
@ApiPropertyOptional() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ApiPropertyOptional() | |
@ApiPropertyOptional() | |
@IsObject() |
What change does this PR introduce?
@ApiExcludeController()
and add@ExternalApiAccessible()
decoratorOrganizationResponseDto
Fixes NV-1920
Why was this change needed?
So that organizations' APIs can be accessed using API Key
Other information (Screenshots)