Skip to content

Commit ce3f763

Browse files
Merge pull request #1127 from credebl/develop
Sync changes from DEV to QA.
2 parents 637dd54 + 5d48626 commit ce3f763

File tree

52 files changed

+1273
-792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1273
-792
lines changed

apps/api-gateway/src/agent-service/agent-service.controller.ts

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,20 @@ export class AgentController {
6161

6262
/**
6363
* Get Organization agent health
64-
* @param orgId
65-
* @param reqUser
66-
* @param res
64+
* @param orgId The ID of the organization
65+
* @param reqUser The user making the request
66+
* @param res The response object
6767
* @returns Get agent details
6868
*/
6969
@Get('/orgs/:orgId/agents/health')
7070
@ApiOperation({
7171
summary: 'Get the agent health details',
72-
description: 'Get the agent health details'
72+
description: 'Get the agent health details for the organization'
7373
})
74-
@UseGuards(AuthGuard('jwt'))
75-
async getAgentHealth(@Param('orgId') orgId: string, @User() reqUser: user, @Res() res: Response): Promise<Response> {
74+
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
75+
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.HOLDER, OrgRoles.ISSUER, OrgRoles.SUPER_ADMIN, OrgRoles.MEMBER, OrgRoles.VERIFIER)
76+
77+
async getAgentHealth(@Param('orgId') orgId: string, @User() reqUser: user, @Res() res: Response): Promise<Response> {
7678
const agentData = await this.agentService.getAgentHealth(reqUser, orgId);
7779

7880
const finalResponse: IResponse = {
@@ -84,10 +86,16 @@ export class AgentController {
8486
return res.status(HttpStatus.OK).json(finalResponse);
8587
}
8688

89+
/**
90+
* Get the ledger config details
91+
* @param reqUser The user making the request
92+
* @param res The response object
93+
* @returns Ledger config details
94+
*/
8795
@Get('/orgs/agents/ledgerConfig')
8896
@ApiOperation({
8997
summary: 'Get the ledger config details',
90-
description: 'Get the ledger config details'
98+
description: 'Get the all supported ledger configuration details for the platform'
9199
})
92100
@UseGuards(AuthGuard('jwt'))
93101
async getLedgerDetails(@User() reqUser: user, @Res() res: Response): Promise<Response> {
@@ -104,14 +112,15 @@ export class AgentController {
104112

105113
/**
106114
* Spinup the agent by organization
107-
* @param agentSpinupDto
108-
* @param user
115+
* @param agentSpinupDto The details of the agent to be spun up
116+
* @param user The user making the request
117+
* @param res The response object
109118
* @returns Get agent status
110119
*/
111120
@Post('/orgs/:orgId/agents/spinup')
112121
@ApiOperation({
113-
summary: 'Agent spinup',
114-
description: 'Create a new agent spin up.'
122+
summary: 'Spinup the platform admin agent',
123+
description: 'Initialize and configure a new platform admin agent for the platform.'
115124
})
116125
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
117126
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN)
@@ -139,20 +148,20 @@ export class AgentController {
139148

140149
/**
141150
* Create wallet for shared agent
142-
* @param orgId
143-
* @param createTenantDto
144-
* @param user
145-
* @param res
146-
* @returns wallet initialization status
151+
* @param orgId The ID of the organization
152+
* @param createTenantDto The details of the tenant to be created
153+
* @param user The user making the request
154+
* @param res The response object
155+
* @returns Wallet initialization status
147156
*/
148157
@Post('/orgs/:orgId/agents/wallet')
149158
@ApiOperation({
150-
summary: 'Shared Agent',
151-
description: 'Create a shared agent.'
159+
summary: 'Create Shared Agent Wallet',
160+
description: 'Initialize and create a shared agent wallet for the organization.'
152161
})
153162
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
154163
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN)
155-
@ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
164+
@ApiResponse({ status: HttpStatus.CREATED, description: 'Wallet successfully created', type: ApiResponseDto })
156165
async createTenant(
157166
@Param('orgId') orgId: string,
158167
@Body() createTenantDto: CreateTenantDto,
@@ -174,13 +183,16 @@ export class AgentController {
174183

175184
/**
176185
* Create wallet
177-
* @param orgId
178-
* @returns wallet
186+
* @param orgId The ID of the organization
187+
* @param createWalletDto The details of the wallet to be created
188+
* @param user The user making the request
189+
* @param res The response object
190+
* @returns Wallet details
179191
*/
180192
@Post('/orgs/:orgId/agents/createWallet')
181193
@ApiOperation({
182-
summary: 'Create wallet',
183-
description: 'Create wallet'
194+
summary: 'Create tenant in the agent',
195+
description: 'Create a new wallet for the organization without storing the wallet details in the platform.'
184196
})
185197
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
186198
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN)
@@ -203,16 +215,18 @@ export class AgentController {
203215
return res.status(HttpStatus.CREATED).json(finalResponse);
204216
}
205217

206-
// This function will be used after multiple did method implementation in create wallet
207218
/**
208219
* Create did
209-
* @param orgId
210-
* @returns did
220+
* @param orgId The ID of the organization
221+
* @param createDidDto The details of the DID to be created
222+
* @param user The user making the request
223+
* @param res The response object
224+
* @returns DID details
211225
*/
212226
@Post('/orgs/:orgId/agents/did')
213227
@ApiOperation({
214-
summary: 'Create new did',
215-
description: 'Create new did for an organization'
228+
summary: 'Create new DID',
229+
description: 'Create a new DID for an organization wallet'
216230
})
217231
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
218232
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.ISSUER)
@@ -246,10 +260,15 @@ export class AgentController {
246260

247261
/**
248262
* Create Secp256k1 key pair for polygon DID
249-
* @param orgId
263+
* @param orgId The ID of the organization
264+
* @param res The response object
250265
* @returns Secp256k1 key pair for polygon DID
251266
*/
252267
@Post('/orgs/:orgId/agents/polygon/create-keys')
268+
@ApiOperation({
269+
summary: 'Create Secp256k1 key pair for polygon DID',
270+
description: 'Create Secp256k1 key pair for polygon DID for an organization'
271+
})
253272
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
254273
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN, OrgRoles.PLATFORM_ADMIN, OrgRoles.ISSUER, OrgRoles.VERIFIER)
255274
@ApiResponse({ status: HttpStatus.CREATED, description: 'Success', type: ApiResponseDto })
@@ -267,14 +286,15 @@ export class AgentController {
267286

268287
/**
269288
* Configure the agent by organization
270-
* @param agentSpinupDto
271-
* @param user
272-
* @returns Get agent status
289+
* @param agentConfigureDto The details of the agent configuration
290+
* @param user The user making the request
291+
* @param res The response object
292+
* @returns Agent configuration status
273293
*/
274294
@Post('/orgs/:orgId/agents/configure')
275295
@ApiOperation({
276-
summary: 'Agent configure',
277-
description: 'Create a new agent configure.'
296+
summary: 'Configure the organization agent',
297+
description: 'Configure the running dedicated agent for the organization using the provided configuration details.'
278298
})
279299
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
280300
@Roles(OrgRoles.OWNER, OrgRoles.ADMIN)
@@ -299,10 +319,17 @@ export class AgentController {
299319
return res.status(HttpStatus.CREATED).json(finalResponse);
300320
}
301321

322+
/**
323+
* Delete wallet
324+
* @param orgId The ID of the organization
325+
* @param user The user making the request
326+
* @param res The response object
327+
* @returns Success message
328+
*/
302329
@Delete('/orgs/:orgId/agents/wallet')
303330
@ApiOperation({
304-
summary: 'Delete wallet',
305-
description: 'Delete agent wallet by organization.'
331+
summary: 'Delete agent wallet',
332+
description: 'Delete agent wallet for the organization using orgId.'
306333
})
307334
@UseGuards(AuthGuard('jwt'), OrgRolesGuard)
308335
@Roles(OrgRoles.OWNER)
@@ -321,4 +348,4 @@ export class AgentController {
321348

322349
return res.status(HttpStatus.OK).json(finalResponse);
323350
}
324-
}
351+
}

apps/api-gateway/src/authz/authz.controller.ts

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ export class AuthzController {
4040
private readonly commonService: CommonService) { }
4141

4242
/**
43-
* @param email
44-
* @param verificationcode
45-
* @returns User's email verification status
43+
* Verify user’s email address.
44+
*
45+
* @param email The email address of the user.
46+
* @param verificationcode The verification code sent to the user's email.
47+
* @returns Returns the email verification status.
4648
*/
4749
@Get('/verify')
4850
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
49-
@ApiOperation({ summary: 'Verify user’s email', description: 'Verify user’s email' })
51+
@ApiOperation({ summary: 'Verify user’s email', description: 'Checks if the provided verification code is valid for the given email.' })
5052
async verifyEmail(@Query() query: EmailVerificationDto, @Res() res: Response): Promise<Response> {
5153
await this.authzService.verifyEmail(query);
5254
const finalResponse: IResponseType = {
@@ -55,13 +57,14 @@ export class AuthzController {
5557
};
5658

5759
return res.status(HttpStatus.OK).json(finalResponse);
58-
5960
}
6061

6162
/**
62-
* @param email
63-
* @returns User's verification email sent status
64-
*/
63+
* Sends a verification email to the user.
64+
*
65+
* @body UserEmailVerificationDto.
66+
* @returns The status of the verification email.
67+
*/
6568
@Post('/verification-mail')
6669
@ApiResponse({ status: HttpStatus.CREATED, description: 'Created', type: ApiResponseDto })
6770
@ApiOperation({ summary: 'Send verification email', description: 'Send verification email to new user' })
@@ -75,13 +78,14 @@ export class AuthzController {
7578
}
7679

7780
/**
78-
*
79-
* @Body userInfo
81+
* Registers a new user on the platform.
82+
*
83+
* @body AddUserDetailsDto
8084
* @returns User's registration status and user details
8185
*/
8286
@Post('/signup')
8387
@ApiResponse({ status: HttpStatus.CREATED, description: 'Created', type: ApiResponseDto })
84-
@ApiOperation({ summary: 'Register new user to platform', description: 'Register new user to platform' })
88+
@ApiOperation({ summary: 'Register new user to platform', description: 'Register new user to platform with the provided details.' })
8589
async addUserDetails(@Body() userInfo: AddUserDetailsDto, @Res() res: Response): Promise<Response> {
8690
const userData = await this.authzService.addUserDetails(userInfo);
8791
const finalResponse = {
@@ -93,13 +97,15 @@ export class AuthzController {
9397

9498
}
9599
/**
96-
* @Body loginUserDto
100+
* Authenticates a user and returns an access token.
101+
*
102+
* @body LoginUserDto
97103
* @returns User's access token details
98104
*/
99105
@Post('/signin')
100106
@ApiOperation({
101107
summary: 'Authenticate the user for the access',
102-
description: 'Authenticate the user for the access'
108+
description: 'Allows registered user to sign.'
103109
})
104110
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: AuthTokenResponse })
105111
@ApiBody({ type: LoginUserDto })
@@ -120,11 +126,18 @@ export class AuthzController {
120126
}
121127
}
122128

129+
130+
/**
131+
* Resets user's password.
132+
*
133+
* @body ResetPasswordDto
134+
* @returns The password reset status.
135+
*/
123136
@Post('/reset-password')
124137
@ApiOperation({
125138
summary: 'Reset password',
126-
description: 'Reset Password of the user'
127-
})
139+
description: 'Allows users to reset a new password which should be different form existing password.'
140+
})
128141
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
129142
async resetPassword(@Body() resetPasswordDto: ResetPasswordDto, @Res() res: Response): Promise<Response> {
130143

@@ -134,15 +147,19 @@ export class AuthzController {
134147
message: ResponseMessages.user.success.resetPassword,
135148
data: userData
136149
};
137-
138150
return res.status(HttpStatus.OK).json(finalResponse);
139-
140151
}
141152

153+
/**
154+
* Initiates the password reset process by sending a reset link to the user's email.
155+
*
156+
* @body ForgotPasswordDto
157+
* @returns Status message indicating whether the reset link was sent successfully.
158+
*/
142159
@Post('/forgot-password')
143160
@ApiOperation({
144161
summary: 'Forgot password',
145-
description: 'Forgot Password of the user'
162+
description: 'Sends a password reset link to the user’s email.'
146163
})
147164
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
148165
async forgotPassword(@Body() forgotPasswordDto: ForgotPasswordDto, @Res() res: Response): Promise<Response> {
@@ -156,10 +173,17 @@ export class AuthzController {
156173
return res.status(HttpStatus.OK).json(finalResponse);
157174
}
158175

176+
/**
177+
* Resets the user's password using a verification token.
178+
*
179+
* @param email The email address of the user.
180+
* @body ResetTokenPasswordDto
181+
* @returns Status message indicating whether the password reset was successful.
182+
*/
159183
@Post('/password-reset/:email')
160184
@ApiOperation({
161-
summary: 'Reset password with token',
162-
description: 'Reset Password of the user using token'
185+
summary: 'Reset password with verification token',
186+
description: 'Resets a user’s password using a verification token sent to their email'
163187
})
164188
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
165189
async resetNewPassword(
@@ -173,15 +197,19 @@ export class AuthzController {
173197
message: ResponseMessages.user.success.resetPassword,
174198
data: userData
175199
};
176-
177200
return res.status(HttpStatus.OK).json(finalResponse);
178-
179201
}
180202

203+
/**
204+
* Generates a new access token using a refresh token.
205+
*
206+
* @body RefreshTokenDto
207+
* @returns New access token and its details.
208+
*/
181209
@Post('/refresh-token')
182210
@ApiOperation({
183211
summary: 'Token from refresh token',
184-
description: 'Get a new token from a refresh token'
212+
description: 'Generates a new access token using a refresh token.'
185213
})
186214
@ApiResponse({ status: HttpStatus.OK, description: 'Success', type: ApiResponseDto })
187215
async refreshToken(

apps/api-gateway/src/authz/dtos/forgot-password.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Transform } from 'class-transformer';
55
import { trim } from '@credebl/common/cast.helper';
66

77
export class ForgotPasswordDto {
8-
@ApiProperty({ example: 'awqx@getnada.com' })
8+
@ApiProperty({ example: 'awqx@yopmail.com' })
99
@IsEmail({}, { message: 'Please provide a valid email' })
1010
@IsNotEmpty({ message: 'Email is required' })
1111
@IsString({ message: 'Email should be a string' })

apps/api-gateway/src/authz/dtos/reset-password.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Transform } from 'class-transformer';
55
import { trim } from '@credebl/common/cast.helper';
66

77
export class ResetPasswordDto {
8-
@ApiProperty({ example: 'awqx@getnada.com' })
8+
@ApiProperty({ example: 'awqx@yopmail.com' })
99
@IsEmail({}, { message: 'Please provide a valid email' })
1010
@IsNotEmpty({ message: 'Email is required' })
1111
@IsString({ message: 'Email should be a string' })

0 commit comments

Comments
 (0)