diff --git a/apps/api-gateway/src/organization/dtos/get-all-organizations.dto.ts b/apps/api-gateway/src/organization/dtos/get-all-organizations.dto.ts deleted file mode 100644 index 0aac2dd41..000000000 --- a/apps/api-gateway/src/organization/dtos/get-all-organizations.dto.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Transform, Type } from 'class-transformer'; -import { toNumber } from '@credebl/common/cast.helper'; -import { ApiProperty } from '@nestjs/swagger'; -import { IsInt, IsOptional, Min } from 'class-validator'; - -export class GetAllOrganizationsDto { - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @Transform(({ value }) => toNumber(value)) - @IsInt({ message: 'Page number must be a positive number' }) - @Min(1, { message: 'Page number must be greater than or equal to 1' }) - pageNumber = 1; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => String) - search = ''; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @IsInt({ message: 'Page Size must be a positive number' }) - @Min(1, { message: 'Page Size must be greater than or equal to 1' }) - pageSize = 10; -} diff --git a/apps/api-gateway/src/organization/dtos/send-invitation.dto.ts b/apps/api-gateway/src/organization/dtos/send-invitation.dto.ts index ab30013aa..cc2c22c4c 100644 --- a/apps/api-gateway/src/organization/dtos/send-invitation.dto.ts +++ b/apps/api-gateway/src/organization/dtos/send-invitation.dto.ts @@ -1,5 +1,5 @@ import { ApiExtraModels, ApiProperty } from '@nestjs/swagger'; -import { IsArray, IsEmail, IsNotEmpty, IsString, ValidateNested } from 'class-validator'; +import { IsArray, IsEmail, IsNotEmpty, IsString, IsUUID, ValidateNested } from 'class-validator'; import { Transform, Type } from 'class-transformer'; import { trim } from '@credebl/common/cast.helper'; @@ -16,6 +16,7 @@ export class SendInvitationDto { @ApiProperty({ example: [2, 1, 3] }) @IsNotEmpty({ message: 'Please provide valid orgRoleId' }) @IsArray() + @IsUUID('4', { each: true, message: 'Invalid format of orgRoleId' }) orgRoleId: string[]; } diff --git a/apps/api-gateway/src/organization/dtos/update-user-roles.dto.ts b/apps/api-gateway/src/organization/dtos/update-user-roles.dto.ts index 42fb98f1d..b9bc30961 100644 --- a/apps/api-gateway/src/organization/dtos/update-user-roles.dto.ts +++ b/apps/api-gateway/src/organization/dtos/update-user-roles.dto.ts @@ -1,4 +1,4 @@ -import { IsArray, IsNotEmpty} from 'class-validator'; +import { ArrayNotEmpty, IsArray, IsNotEmpty, IsUUID, MinLength} from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; @@ -8,10 +8,14 @@ export class UpdateUserRolesDto { userId: string; @ApiProperty({ - example: [2, 1, 3] + example: ['2', '1', '3'] }) + + // @IsNotEmpty() @IsArray() - @IsNotEmpty({ message: 'orgRoleId is required' }) + @ArrayNotEmpty() + @MinLength(0, {each: true}) + @IsNotEmpty({each: true}) + @IsUUID('4', { each: true, message: 'Invalid format of orgRoleId' }) orgRoleId: string[]; - - } \ No newline at end of file +} \ No newline at end of file diff --git a/apps/api-gateway/src/organization/organization.controller.ts b/apps/api-gateway/src/organization/organization.controller.ts index a3759ff70..f0a5c7ece 100644 --- a/apps/api-gateway/src/organization/organization.controller.ts +++ b/apps/api-gateway/src/organization/organization.controller.ts @@ -17,13 +17,11 @@ import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; import { Roles } from '../authz/decorators/roles.decorator'; import { OrgRoles } from 'libs/org-roles/enums'; import { UpdateUserRolesDto } from './dtos/update-user-roles.dto'; -import { GetAllOrganizationsDto } from './dtos/get-all-organizations.dto'; -import { GetAllSentInvitationsDto } from './dtos/get-all-sent-invitations.dto'; import { UpdateOrganizationDto } from './dtos/update-organization-dto'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { IUserRequestInterface } from '../interfaces/IUserRequestInterface'; -import { GetAllUsersDto } from '../user/dto/get-all-users.dto'; import { ImageServiceService } from '@credebl/image-service'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; @UseFilters(CustomExceptionFilter) @Controller('orgs') @@ -79,9 +77,9 @@ export class OrganizationController { type: String, required: false }) - async get(@Query() getAllUsersDto: GetAllOrganizationsDto, @Res() res: Response): Promise { + async get(@Query() paginationDto: PaginationDto, @Res() res: Response): Promise { - const users = await this.organizationService.getPublicOrganizations(getAllUsersDto); + const users = await this.organizationService.getPublicOrganizations(paginationDto); const finalResponse: IResponse = { statusCode: HttpStatus.OK, message: ResponseMessages.organisation.success.getOrganizations, @@ -195,9 +193,9 @@ export class OrganizationController { required: false }) @Roles(OrgRoles.OWNER, OrgRoles.SUPER_ADMIN, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER) - async getInvitationsByOrgId(@Param('orgId') orgId: string, @Query() getAllInvitationsDto: GetAllSentInvitationsDto, @Res() res: Response): Promise { + async getInvitationsByOrgId(@Param('orgId') orgId: string, @Query() paginationDto: PaginationDto, @Res() res: Response): Promise { - const getInvitationById = await this.organizationService.getInvitationsByOrgId(orgId, getAllInvitationsDto); + const getInvitationById = await this.organizationService.getInvitationsByOrgId(orgId, paginationDto); const finalResponse: IResponse = { statusCode: HttpStatus.OK, @@ -231,9 +229,9 @@ export class OrganizationController { type: String, required: false }) - async getOrganizations(@Query() getAllOrgsDto: GetAllOrganizationsDto, @Res() res: Response, @User() reqUser: user): Promise { + async getOrganizations(@Query() paginationDto: PaginationDto, @Res() res: Response, @User() reqUser: user): Promise { - const getOrganizations = await this.organizationService.getOrganizations(getAllOrgsDto, reqUser.id); + const getOrganizations = await this.organizationService.getOrganizations(paginationDto, reqUser.id); const finalResponse: IResponse = { statusCode: HttpStatus.OK, @@ -291,8 +289,8 @@ export class OrganizationController { type: String, required: false }) - async getOrganizationUsers(@User() user: IUserRequestInterface, @Query() getAllUsersDto: GetAllUsersDto, @Param('orgId') orgId: string, @Res() res: Response): Promise { - const users = await this.organizationService.getOrgUsers(orgId, getAllUsersDto); + async getOrganizationUsers(@User() user: IUserRequestInterface, @Query() paginationDto: PaginationDto, @Param('orgId') orgId: string, @Res() res: Response): Promise { + const users = await this.organizationService.getOrgUsers(orgId, paginationDto); const finalResponse: IResponse = { statusCode: HttpStatus.OK, message: ResponseMessages.user.success.fetchUsers, @@ -350,7 +348,7 @@ export class OrganizationController { @UseGuards(AuthGuard('jwt'), OrgRolesGuard) @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto }) @ApiOperation({ summary: 'Update user roles', description: 'update user roles' }) - async updateUserRoles(@Body() updateUserDto: UpdateUserRolesDto, @Param('orgId') orgId: string, @Param('userId') userId: string, @Res() res: Response): Promise { + async updateUserRoles(@Body() updateUserDto: UpdateUserRolesDto, @Param('orgId') orgId: string, @Param('userId', new ParseUUIDPipe({exceptionFactory: (): Error => { throw new BadRequestException(ResponseMessages.organisation.error.invalidUserId); }})) userId: string, @Res() res: Response): Promise { updateUserDto.orgId = orgId; updateUserDto.userId = userId; @@ -387,12 +385,17 @@ export class OrganizationController { /** * @returns Boolean */ + //Todo @Delete('/:orgId') @ApiOperation({ summary: 'Delete Organization', description: 'Delete an organization' }) - @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto }) + @ApiExcludeEndpoint() + @ApiResponse({ status: HttpStatus.ACCEPTED, description: 'Success', type: ApiResponseDto }) @ApiBearerAuth() @UseGuards(AuthGuard('jwt')) - async deleteOrganization(@Param('orgId') orgId: number, @Res() res: Response): Promise { + async deleteOrganization( + @Param('orgId') orgId: string, + @Res() res: Response + ): Promise { await this.organizationService.deleteOrganization(orgId); @@ -403,6 +406,7 @@ export class OrganizationController { return res.status(HttpStatus.ACCEPTED).json(finalResponse); } + @Delete('/:orgId/invitations/:invitationId') @ApiOperation({ summary: 'Delete organization invitation', description: 'Delete organization invitation' }) @ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto }) @@ -411,7 +415,7 @@ export class OrganizationController { @UseGuards(AuthGuard('jwt'), OrgRolesGuard) async deleteOrganizationInvitation( @Param('orgId') orgId: string, - @Param('invitationId') invitationId: string, + @Param('invitationId', new ParseUUIDPipe({exceptionFactory: (): Error => { throw new BadRequestException(ResponseMessages.organisation.error.invalidInvitationId); }})) invitationId: string, @Res() res: Response ): Promise { await this.organizationService.deleteOrganizationInvitation(orgId, invitationId); diff --git a/apps/api-gateway/src/organization/organization.service.ts b/apps/api-gateway/src/organization/organization.service.ts index 11ce21f38..45a45f843 100644 --- a/apps/api-gateway/src/organization/organization.service.ts +++ b/apps/api-gateway/src/organization/organization.service.ts @@ -3,18 +3,15 @@ import { Injectable } from '@nestjs/common'; import { ClientProxy } from '@nestjs/microservices'; import { BaseService } from 'libs/service/base.service'; import { CreateOrganizationDto } from './dtos/create-organization-dto'; -import { GetAllOrganizationsDto } from './dtos/get-all-organizations.dto'; -import { GetAllSentInvitationsDto } from './dtos/get-all-sent-invitations.dto'; import { BulkSendInvitationDto } from './dtos/send-invitation.dto'; import { UpdateUserRolesDto } from './dtos/update-user-roles.dto'; import { UpdateOrganizationDto } from './dtos/update-organization-dto'; -import { GetAllUsersDto } from '../user/dto/get-all-users.dto'; import { IOrgRoles } from 'libs/org-roles/interfaces/org-roles.interface'; import { organisation } from '@prisma/client'; import { IGetOrgById, IGetOrganization } from 'apps/organization/interfaces/organization.interface'; -import { IOrganizationInvitations } from '@credebl/common/interfaces/organizations.interface'; +import { IOrganizationInvitations, IOrganizationDashboard} from '@credebl/common/interfaces/organization.interface'; import { IOrgUsers } from 'apps/user/interfaces/user.interface'; -import { IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; @Injectable() export class OrganizationService extends BaseService { @@ -48,9 +45,9 @@ export class OrganizationService extends BaseService { * @returns Organizations details */ - async getOrganizations(getAllOrgsDto: GetAllOrganizationsDto, userId: string): Promise { - const payload = { userId, ...getAllOrgsDto }; - const fetchOrgs = await this.sendNats(this.serviceProxy, 'get-organizations', payload); + async getOrganizations(paginationDto: PaginationDto, userId: string): Promise { + const payload = { userId, ...paginationDto }; + const fetchOrgs = await this.sendNatsMessage(this.serviceProxy, 'get-organizations', payload); return fetchOrgs; } @@ -59,9 +56,10 @@ export class OrganizationService extends BaseService { * @param * @returns Public organizations list */ - async getPublicOrganizations(getAllOrgsDto: GetAllOrganizationsDto): Promise { - const payload = { ...getAllOrgsDto }; - return this.sendNats(this.serviceProxy, 'get-public-organizations', payload); + async getPublicOrganizations(paginationDto: PaginationDto): Promise { + const payload = { ...paginationDto }; + const PublicOrg = this.sendNatsMessage(this.serviceProxy, 'get-public-organizations', payload); + return PublicOrg; } async getPublicProfile(orgSlug: string): Promise { @@ -90,9 +88,9 @@ export class OrganizationService extends BaseService { */ async getInvitationsByOrgId( orgId: string, - getAllInvitationsDto: GetAllSentInvitationsDto + pagination: PaginationDto ): Promise { - const { pageNumber, pageSize, search } = getAllInvitationsDto; + const { pageNumber, pageSize, search } = pagination; const payload = { orgId, pageNumber, pageSize, search }; return this.sendNats(this.serviceProxy, 'get-invitations-by-orgId', payload); } @@ -136,9 +134,9 @@ export class OrganizationService extends BaseService { async getOrgUsers( orgId: string, - getAllUsersDto: GetAllUsersDto + paginationDto: PaginationDto ): Promise { - const { pageNumber, pageSize, search } = getAllUsersDto; + const { pageNumber, pageSize, search } = paginationDto; const payload = { orgId, pageNumber, pageSize, search }; return this.sendNats(this.serviceProxy, 'fetch-organization-user', payload); @@ -153,7 +151,7 @@ export class OrganizationService extends BaseService { } async deleteOrganization( - orgId: number + orgId: string ): Promise { const payload = { orgId }; diff --git a/apps/api-gateway/src/user/dto/get-all-invitations.dto.ts b/apps/api-gateway/src/user/dto/get-all-invitations.dto.ts index 89f079f19..0e8133523 100644 --- a/apps/api-gateway/src/user/dto/get-all-invitations.dto.ts +++ b/apps/api-gateway/src/user/dto/get-all-invitations.dto.ts @@ -1,28 +1,11 @@ -import { IsOptional, IsString } from 'class-validator'; -import { Transform, Type } from 'class-transformer'; -import { toNumber } from '@credebl/common/cast.helper'; +import { IsOptional, IsString} from 'class-validator'; + import { ApiProperty } from '@nestjs/swagger'; import { Invitation } from '@credebl/enum/enum'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; -export class GetAllInvitationsDto { - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @Transform(({ value }) => toNumber(value)) - pageNumber = 1; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => String) - search = ''; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @Transform(({ value }) => toNumber(value)) - pageSize = 8; - +export class GetAllInvitationsDto extends PaginationDto { @ApiProperty({ required: false }) @IsOptional() @IsString() diff --git a/apps/api-gateway/src/user/dto/get-all-users.dto.ts b/apps/api-gateway/src/user/dto/get-all-users.dto.ts deleted file mode 100644 index 8a9bbd8b2..000000000 --- a/apps/api-gateway/src/user/dto/get-all-users.dto.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Transform, Type } from 'class-transformer'; -import { toNumber } from '@credebl/common/cast.helper'; - -import { ApiProperty } from '@nestjs/swagger'; -import { IsOptional } from 'class-validator'; - -export class GetAllUsersDto { - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @Transform(({ value }) => toNumber(value)) - pageNumber = 1; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => String) - search = ''; - - @ApiProperty({ required: false }) - @IsOptional() - @Type(() => Number) - @Transform(({ value }) => toNumber(value)) - pageSize = 10; - -} diff --git a/apps/api-gateway/src/user/user.controller.ts b/apps/api-gateway/src/user/user.controller.ts index 72c5c9ace..332b2b2d9 100644 --- a/apps/api-gateway/src/user/user.controller.ts +++ b/apps/api-gateway/src/user/user.controller.ts @@ -39,7 +39,6 @@ import { AcceptRejectInvitationDto } from './dto/accept-reject-invitation.dto'; import { Invitation } from '@credebl/enum/enum'; import { IUserRequestInterface } from './interfaces'; import { GetAllInvitationsDto } from './dto/get-all-invitations.dto'; -import { GetAllUsersDto } from './dto/get-all-users.dto'; import { UpdateUserProfileDto } from './dto/update-user-profile.dto'; import { CustomExceptionFilter } from 'apps/api-gateway/common/exception-handler'; import { AddPasskeyDetailsDto } from './dto/add-user.dto'; @@ -50,6 +49,7 @@ import { OrgRolesGuard } from '../authz/guards/org-roles.guard'; import { OrgRoles } from 'libs/org-roles/enums'; import { CreateUserCertificateDto } from './dto/share-certificate.dto'; import { AwsService } from '@credebl/aws/aws.service'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; @UseFilters(CustomExceptionFilter) @Controller('users') @@ -91,10 +91,10 @@ export class UserController { }) async get( @User() user: IUserRequestInterface, - @Query() getAllUsersDto: GetAllUsersDto, + @Query() paginationDto: PaginationDto, @Res() res: Response ): Promise { - const users = await this.userService.get(getAllUsersDto); + const users = await this.userService.get(paginationDto); const finalResponse: IResponse = { statusCode: HttpStatus.OK, message: ResponseMessages.user.success.fetchUsers, @@ -224,7 +224,7 @@ export class UserController { required: false }) async invitations( - @Query() getAllInvitationsDto: GetAllInvitationsDto, + @Query() getAllInvitationsDto: GetAllInvitationsDto, @User() reqUser: user, @Res() res: Response ): Promise { diff --git a/apps/api-gateway/src/user/user.service.ts b/apps/api-gateway/src/user/user.service.ts index db8d0fbcb..0c3449ad3 100644 --- a/apps/api-gateway/src/user/user.service.ts +++ b/apps/api-gateway/src/user/user.service.ts @@ -4,7 +4,6 @@ import { ClientProxy } from '@nestjs/microservices'; import { BaseService } from 'libs/service/base.service'; import { AcceptRejectInvitationDto } from './dto/accept-reject-invitation.dto'; import { GetAllInvitationsDto } from './dto/get-all-invitations.dto'; -import { GetAllUsersDto } from './dto/get-all-users.dto'; import { UpdateUserProfileDto } from './dto/update-user-profile.dto'; import { AddPasskeyDetailsDto } from './dto/add-user.dto'; import { UpdatePlatformSettingsDto } from './dto/update-platform-settings.dto'; @@ -13,6 +12,7 @@ import { IUsersProfile, ICheckUserDetails } from 'apps/user/interfaces/user.inte import { IUsersActivity } from 'libs/user-activity/interface'; import { IUserInvitations } from '@credebl/common/interfaces/user.interface'; import { user } from '@prisma/client'; +import { PaginationDto } from '@credebl/common/dtos/pagination.dto'; @Injectable() export class UserService extends BaseService { @@ -78,9 +78,9 @@ export class UserService extends BaseService { } async get( - getAllUsersDto: GetAllUsersDto + paginationDto:PaginationDto ): Promise { - const { pageNumber, pageSize, search } = getAllUsersDto; + const { pageNumber, pageSize, search } = paginationDto; const payload = { pageNumber, pageSize, search }; return this.sendNatsMessage(this.serviceProxy, 'fetch-users', payload); } diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 5fe8aa255..6b398c000 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -13,8 +13,7 @@ import { PrismaService } from '@credebl/prisma-service'; import { UserOrgRolesService } from '@credebl/user-org-roles'; import { organisation } from '@prisma/client'; import { ResponseMessages } from '@credebl/common/response-messages'; -import { IOrganizationInvitations } from '@credebl/common/interfaces/organizations.interface'; -import { IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; +import { IOrganizationInvitations, IOrganizationDashboard} from '@credebl/common/interfaces/organization.interface'; @Injectable() export class OrganizationRepository { @@ -150,7 +149,7 @@ export class OrganizationRepository { }); } catch (error) { this.logger.error(`error: ${JSON.stringify(error)}`); - throw new InternalServerErrorException(error); + throw error; } } diff --git a/apps/organization/src/organization.controller.ts b/apps/organization/src/organization.controller.ts index 2ec45e43d..16f8c5669 100644 --- a/apps/organization/src/organization.controller.ts +++ b/apps/organization/src/organization.controller.ts @@ -7,10 +7,9 @@ import { CreateOrganizationDto } from '../dtos/create-organization.dto'; import { BulkSendInvitationDto } from '../dtos/send-invitation.dto'; import { UpdateInvitationDto } from '../dtos/update-invitation.dt'; import { IGetOrgById, IGetOrganization, IUpdateOrganization, Payload } from '../interfaces/organization.interface'; -import { IOrganizationInvitations } from '@credebl/common/interfaces/organizations.interface'; +import { IOrganizationInvitations, IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; import { organisation } from '@prisma/client'; import { IOrgRoles } from 'libs/org-roles/interfaces/org-roles.interface'; -import { IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; @Controller() export class OrganizationController { diff --git a/apps/organization/src/organization.service.ts b/apps/organization/src/organization.service.ts index c7b42c095..8b998dddb 100644 --- a/apps/organization/src/organization.service.ts +++ b/apps/organization/src/organization.service.ts @@ -23,8 +23,7 @@ import { UserActivityService } from '@credebl/user-activity'; import { CommonConstants } from '@credebl/common/common.constant'; import { map } from 'rxjs/operators'; import { IOrgRoles } from 'libs/org-roles/interfaces/org-roles.interface'; -import { IOrganizationInvitations } from '@credebl/common/interfaces/organizations.interface'; -import { IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; +import { IOrganizationInvitations, IOrganizationDashboard } from '@credebl/common/interfaces/organization.interface'; @Injectable() export class OrganizationService { constructor( diff --git a/apps/api-gateway/src/organization/dtos/get-all-sent-invitations.dto.ts b/libs/common/src/dtos/pagination.dto.ts similarity index 58% rename from apps/api-gateway/src/organization/dtos/get-all-sent-invitations.dto.ts rename to libs/common/src/dtos/pagination.dto.ts index eaa15380d..17bf21fad 100644 --- a/apps/api-gateway/src/organization/dtos/get-all-sent-invitations.dto.ts +++ b/libs/common/src/dtos/pagination.dto.ts @@ -1,14 +1,13 @@ import { Transform, Type } from 'class-transformer'; import { toNumber } from '@credebl/common/cast.helper'; - import { ApiProperty } from '@nestjs/swagger'; -import { IsOptional } from 'class-validator'; +import { IsOptional, Min } from 'class-validator'; -export class GetAllSentInvitationsDto { - @ApiProperty({ required: false }) +export class PaginationDto { + @ApiProperty({ required: false, default: 1 }) @IsOptional() - @Type(() => Number) @Transform(({ value }) => toNumber(value)) + @Min(1, { message: 'Page number must be greater than 0' }) pageNumber = 1; @ApiProperty({ required: false }) @@ -16,10 +15,10 @@ export class GetAllSentInvitationsDto { @Type(() => String) search = ''; - @ApiProperty({ required: false }) + @ApiProperty({ required: false, default: 10 }) @IsOptional() - @Type(() => Number) @Transform(({ value }) => toNumber(value)) + @Min(1, { message: 'Page size must be greater than 0' }) pageSize = 10; } diff --git a/libs/common/src/interfaces/organization.interface.ts b/libs/common/src/interfaces/organization.interface.ts index dd76c021e..09573974a 100644 --- a/libs/common/src/interfaces/organization.interface.ts +++ b/libs/common/src/interfaces/organization.interface.ts @@ -3,4 +3,28 @@ export interface IOrganizationDashboard { schemasCount: number, credentialsCount: number, presentationsCount:number - } \ No newline at end of file + } + + export interface IOrganizationInvitations { + totalPages: number; + invitations: IOrgInvitation[]; + } + + interface IOrgInvitation { + id: string, + orgId: string, + email: string, + userId: string, + status: string, + orgRoles: string[], + createDateTime: Date, + createdBy:string, + organisation: IOrganizations; + } + + interface IOrganizations { + id: string; + name: string; + logoUrl: string; + } + \ No newline at end of file diff --git a/libs/common/src/interfaces/organizations.interface.ts b/libs/common/src/interfaces/organizations.interface.ts deleted file mode 100644 index 8843a6be6..000000000 --- a/libs/common/src/interfaces/organizations.interface.ts +++ /dev/null @@ -1,23 +0,0 @@ -export interface IOrganizationInvitations { - totalPages: number; - invitations: IOrgInvitation[]; - } - - interface IOrgInvitation { - id: string, - orgId: string, - email: string, - userId: string, - status: string, - orgRoles: string[], - createDateTime: Date, - createdBy:string, - organisation: IOrganizations; - } - - interface IOrganizations { - id: string; - name: string; - logoUrl: string; - } - \ No newline at end of file diff --git a/libs/common/src/response-messages/index.ts b/libs/common/src/response-messages/index.ts index a2992fdfa..c0f93d0a1 100644 --- a/libs/common/src/response-messages/index.ts +++ b/libs/common/src/response-messages/index.ts @@ -86,6 +86,8 @@ export const ResponseMessages = { invitationStatusInvalid: 'Unable to delete invitation with accepted/rejected status', invalidOrgId:'Invalid format for orgId', orgIdIsRequired:'OrgId is required', + invalidUserId:'Invalid format of userId', + invalidInvitationId:'Invalid format for invitaion id', ecosystemIdIsRequired:'ecosystemId is required' } diff --git a/libs/org-roles/repositories/index.ts b/libs/org-roles/repositories/index.ts index 0488fd24e..406d04878 100644 --- a/libs/org-roles/repositories/index.ts +++ b/libs/org-roles/repositories/index.ts @@ -58,9 +58,8 @@ export class OrgRolesRepository { return roleDetails; } catch (error) { - this.logger.error(`In get org-roles repository: ${JSON.stringify(error)}`); - throw new InternalServerErrorException('Bad Request'); - + this.logger.error(`In get org-roles by id repository : ${JSON.stringify(error)}`); + throw error; } } } \ No newline at end of file