Skip to content
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: endorsement transactions #132

Merged
merged 5 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions apps/api-gateway/src/ecosystem/ecosystem.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,43 @@ export class EcosystemController {
private readonly ecosystemService: EcosystemService
) { }

@Get('/:ecosystemId/:orgId/endorsement-transactions')
@ApiOperation({ summary: 'Get all endorsement transactions', description: 'Get all endorsement transactions' })
@ApiResponse({ status: 200, description: 'Success', type: ApiResponseDto })
@UseGuards(AuthGuard('jwt'), EcosystemRolesGuard, OrgRolesGuard)
@ApiBearerAuth()
@EcosystemsRoles(EcosystemRoles.ECOSYSTEM_OWNER, EcosystemRoles.ECOSYSTEM_LEAD, EcosystemRoles.ECOSYSTEM_MEMBER)
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER, OrgRoles.MEMBER)
@ApiQuery({
name: 'pageNumber',
type: Number,
required: false
})
@ApiQuery({
name: 'pageSize',
type: Number,
required: false
})
@ApiQuery({
name: 'search',
type: String,
required: false
})
async getEndorsementTranasactions(
@Param('ecosystemId') ecosystemId: string,
@Param('orgId') orgId: string,
@Query() getAllEndorsementsDto: GetAllEndorsementsDto,
@Res() res: Response
): Promise<Response> {

const ecosystemList = await this.ecosystemService.getEndorsementTranasactions(ecosystemId, orgId, getAllEndorsementsDto);
const finalResponse: IResponseType = {
statusCode: HttpStatus.OK,
message: ResponseMessages.ecosystem.success.fetchEndorsors,
data: ecosystemList.response
};
return res.status(HttpStatus.OK).json(finalResponse);
}

@Get('/:orgId')
@ApiOperation({ summary: 'Get all ecosystem', description: 'Get all existing ecosystem' })
Expand Down
20 changes: 9 additions & 11 deletions apps/ecosystem/src/ecosystem.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ export class EcosystemController {
);
}

@MessagePattern({ cmd: 'get-endorsement-transactions' })
async getEndorsementTransactions(
@Body() payload: GetEndorsementsPayload
): Promise<object> {
return this.ecosystemService.getEndorsementTransactions(
payload
);
}

@MessagePattern({ cmd: 'delete-ecosystem-invitations' })
async deleteInvitation(
@Body() payload: {invitationId: string}
Expand All @@ -114,17 +123,6 @@ export class EcosystemController {
payload
);
}


@MessagePattern({ cmd: 'get-endorsement-transactions' })
async getEndorsementTransactions(
@Body() payload: GetEndorsementsPayload
): Promise<object> {
return this.ecosystemService.getEndorsementTransactions(
payload
);
}


/**
*
Expand Down
6 changes: 4 additions & 2 deletions apps/ecosystem/src/ecosystem.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ export class EcosystemRepository {
authorDid: true,
status: true,
type: true,
ecosystemOrgs: true
ecosystemOrgs: true,
requestPayload: true,
responsePayload: true,
createDateTime: true
},
take: pageSize,
skip: (pageNumber - 1) * pageSize,
Expand Down Expand Up @@ -461,7 +464,6 @@ export class EcosystemRepository {
}
}


// eslint-disable-next-line camelcase
async deleteInvitations(invitationId: string): Promise<ecosystem_invitations> {
try {
Expand Down
3 changes: 2 additions & 1 deletion libs/common/src/response-messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export const ResponseMessages = {
schemaRequest: 'Schema transaction request created successfully',
sign: 'Transaction request signed successfully',
invitationReject: 'Ecosystem invitation rejected',
invitationAccept: 'Ecosystem invitation accepted successfully'
invitationAccept: 'Ecosystem invitation accepted successfully',
fetchEndorsors: 'Endorser transactions fetched successfully'
},
error: {
notCreated: 'Error while creating ecosystem',
Expand Down