Skip to content

Commit 7314f1f

Browse files
refactor: agent spinup flow with shared agent
Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com>
1 parent 754f031 commit 7314f1f

4 files changed

Lines changed: 5 additions & 16 deletions

File tree

apps/agent-provisioning/src/agent-provisioning.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AgentType } from '@credebl/enum/enum';
77
import { IWalletProvision } from './interface/agent-provisioning.interfaces';
88
import { RpcException } from '@nestjs/microservices';
99
import { exec } from 'child_process';
10+
1011
dotenv.config();
1112

1213
@Injectable()
@@ -18,7 +19,7 @@ export class AgentProvisioningService {
1819
* @param payload
1920
* @returns Get DID and verkey
2021
*/
21-
async walletProvision(payload: IWalletProvision): Promise<object> {
22+
async walletProvision(payload: IWalletProvision): Promise<object> {
2223
try {
2324
const {
2425
containerName,

apps/agent-service/src/agent-service.service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
/* eslint-disable quotes */
32
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
43
/* eslint-disable yoda */
@@ -745,13 +744,11 @@ export class AgentServiceService {
745744
* @returns Get agent status
746745
*/
747746
async createTenant(payload: ITenantDto, user: IUserRequestInterface): Promise<IStoreOrgAgentDetails> {
748-
console.log('🚀 ~ AgentServiceService ~ createTenant ~ payload:777777777777777777777777', payload);
749747
try {
750748
const agentStatusResponse = {
751749
agentSpinupStatus: AgentSpinUpStatus.PROCESSED
752750
};
753751
const getOrgAgent = await this.agentServiceRepository.getAgentDetails(payload.orgId);
754-
console.log('🚀 ~ AgentServiceService ~ createTenant ~ getOrgAgent:888888888888', getOrgAgent);
755752

756753
// if (AgentSpinUpStatus.COMPLETED === getOrgAgent?.agentSpinUpStatus) {
757754
// this.logger.error(`Your wallet is already been created.`);
@@ -784,7 +781,6 @@ export class AgentServiceService {
784781
* @returns Get agent status
785782
*/
786783
async _createTenant(payload: ITenantDto, user: IUserRequestInterface): Promise<IStoreOrgAgentDetails> {
787-
console.log('🚀 ~ AgentServiceService ~ _createTenant ~ payload:9999999999999', payload);
788784
let agentProcess;
789785
let ledgerIdData = [];
790786
try {
@@ -853,14 +849,12 @@ export class AgentServiceService {
853849
id: agentProcess?.id,
854850
apiKey: await this.commonService.dataEncryption(tenantDetails.walletResponseDetails['token'])
855851
};
856-
console.log('🚀 ~ AgentServiceService ~ _createTenant ~ storeOrgAgentData:111111111111111111', storeOrgAgentData);
857852
// Get organization data
858853
const getOrganization = await this.agentServiceRepository.getOrgDetails(payload.orgId);
859854

860855
this.notifyClientSocket('agent-spinup-process-completed', payload.clientSocketId);
861856

862857
const orgAgentDetails = await this.agentServiceRepository.storeOrgAgentDetails(storeOrgAgentData);
863-
console.log('🚀 ~ AgentServiceService ~ _createTenant ~ orgAgentDetails:222222222222222222222', orgAgentDetails);
864858

865859
// const createdDidDetails = {
866860
// orgId: payload.orgId,

apps/agent-service/src/repositories/agent-service.repository.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
IOrgAgent,
77
IOrgAgentsResponse,
88
IOrgLedgers,
9-
IStoreAgent,
109
IStoreDidDetails,
1110
IStoreOrgAgentDetails,
1211
LedgerNameSpace,
@@ -261,11 +260,9 @@ export class AgentServiceRepository {
261260
}
262261
}
263262

264-
265263
/**
266-
* Set primary DID
267-
* @param did
268-
* @returns did details
264+
* Update agent spinup status
265+
* @param orgId
269266
*/
270267
// eslint-disable-next-line camelcase
271268
async updateAgentSpinupStatus(orgId: string): Promise<org_agents> {
@@ -279,7 +276,7 @@ export class AgentServiceRepository {
279276
}
280277
});
281278
} catch (error) {
282-
this.logger.error(`[setprimaryDid] - Update DID details: ${JSON.stringify(error)}`);
279+
this.logger.error(`[updateAgentSpinupStatus] - Update agent spinup status: ${JSON.stringify(error)}`);
283280
throw error;
284281
}
285282
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
/* eslint-disable no-param-reassign */
32
/* eslint-disable camelcase */
43
/* eslint-disable @typescript-eslint/no-explicit-any */
@@ -260,9 +259,7 @@ export class AgentController {
260259
@Res() res: Response
261260
): Promise<Response> {
262261
createTenantDto.orgId = orgId;
263-
console.log('🚀 ~ AgentController ~ createTenant ~ orgId:', orgId);
264262
const tenantDetails = await this.agentService.createTenant(createTenantDto, user);
265-
console.log('🚀 ~ AgentController ~ createTenant ~ tenantDetails:', tenantDetails);
266263

267264
const finalResponse: IResponse = {
268265
statusCode: HttpStatus.CREATED,

0 commit comments

Comments
 (0)