Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/credebl/platform into qa
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavanakarwade committed Mar 1, 2024
2 parents 97cbddf + 4f20455 commit 025645d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { trim } from '@credebl/common/cast.helper';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { MaxLength, IsString, MinLength, Matches, IsNotEmpty, IsOptional, IsArray } from 'class-validator';
import { MaxLength, IsString, MinLength, Matches, IsNotEmpty, IsOptional, IsArray, IsUUID } from 'class-validator';
const labelRegex = /^[a-zA-Z0-9 ]*$/;
export class CreateTenantDto {
@ApiProperty()
Expand All @@ -28,6 +28,7 @@ export class CreateTenantDto {
@ApiProperty({ example: ["b942473d-6fdd-4a38-b76e-a3314fca66b6"] })
@ApiPropertyOptional()
@IsOptional()
@IsUUID(4, {each:true, message: "Please provide valid ledgerId"})
@IsArray({ message: 'ledgerId must be an array' })
@IsNotEmpty({ message: 'please provide valid ledgerId' })
@IsString({ each: true, message: 'Each ledgerId must be a string' })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export class AcceptRejectEcosystemInvitationDto {
orgName?: string;
orgDid?: string;
userId?: string;
userEmail?: string;
}
5 changes: 3 additions & 2 deletions apps/ecosystem/src/ecosystem.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ export class EcosystemController {
*/
@MessagePattern({ cmd: 'accept-reject-ecosystem-invitations' })
async acceptRejectEcosystemInvitations(payload: {
acceptRejectInvitation: AcceptRejectEcosystemInvitationDto;
acceptRejectInvitation: AcceptRejectEcosystemInvitationDto,
userEmail: string
}): Promise<string> {
return this.ecosystemService.acceptRejectEcosystemInvitations(payload.acceptRejectInvitation);
return this.ecosystemService.acceptRejectEcosystemInvitations(payload.acceptRejectInvitation, payload.userEmail);
}

@MessagePattern({ cmd: 'get-sent-invitations-ecosystemId' })
Expand Down
5 changes: 3 additions & 2 deletions apps/ecosystem/src/ecosystem.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,12 @@ export class EcosystemRepository {
* @returns Invitation details
*/
// eslint-disable-next-line camelcase
async getEcosystemInvitationById(id: string): Promise<ecosystem_invitations> {
async getEcosystemInvitationById(id: string, email: string): Promise<ecosystem_invitations> {
try {
return this.prisma.ecosystem_invitations.findUnique({
where: {
id
id,
email
},
include: {
ecosystem: true
Expand Down
5 changes: 2 additions & 3 deletions apps/ecosystem/src/ecosystem.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export class EcosystemService {
* @param userId
* @returns Ecosystem invitation status
*/
async acceptRejectEcosystemInvitations(acceptRejectInvitation: AcceptRejectEcosystemInvitationDto): Promise<string> {
async acceptRejectEcosystemInvitations(acceptRejectInvitation: AcceptRejectEcosystemInvitationDto, email: string): Promise<string> {
try {
const isMultiEcosystemEnabled = await this.ecosystemRepository.getSpecificEcosystemConfig(
EcosystemConfigSettings.MULTI_ECOSYSTEM
Expand All @@ -442,8 +442,7 @@ export class EcosystemService {
}

const { orgId, status, invitationId, orgName, orgDid, userId } = acceptRejectInvitation;
const invitation = await this.ecosystemRepository.getEcosystemInvitationById(invitationId);

const invitation = await this.ecosystemRepository.getEcosystemInvitationById(invitationId, email);
if (!invitation) {
throw new NotFoundException(ResponseMessages.ecosystem.error.invitationNotFound);
}
Expand Down

0 comments on commit 025645d

Please sign in to comment.