diff --git a/apps/agent-service/src/agent-service.service.ts b/apps/agent-service/src/agent-service.service.ts index fa400ea66..aec33d731 100644 --- a/apps/agent-service/src/agent-service.service.ts +++ b/apps/agent-service/src/agent-service.service.ts @@ -734,6 +734,7 @@ export class AgentServiceService { const storeOrgAgentData: IStoreOrgAgentDetails = { did: tenantDetails.DIDCreationOption.did, + didDoc: tenantDetails.DIDCreationOption.didDocument || tenantDetails.DIDCreationOption.didDoc, //changed the didDoc into didDocument isDidPublic: true, agentSpinUpStatus: AgentSpinUpStatus.COMPLETED, agentsTypeId: agentTypeId, @@ -904,7 +905,7 @@ export class AgentServiceService { const walletResponseDetails = await this._createTenantWallet(walletLabel, platformAdminSpinnedUp.org_agents[0].agentEndPoint, platformAdminSpinnedUp.org_agents[0].apiKey); - if (!walletResponseDetails && !walletResponseDetails.id) { + if (!walletResponseDetails && !walletResponseDetails.id) { throw new InternalServerErrorException('Error while creating the wallet'); } const didCreateOption = { @@ -1260,7 +1261,6 @@ export class AgentServiceService { // Get organization agent details const orgAgentDetails: org_agents = await this.agentServiceRepository.getOrgAgentDetails(orgId); - let agentApiKey; if (orgAgentDetails) { diff --git a/apps/agent-service/src/interface/agent-service.interface.ts b/apps/agent-service/src/interface/agent-service.interface.ts index 54be18406..1cac54307 100644 --- a/apps/agent-service/src/interface/agent-service.interface.ts +++ b/apps/agent-service/src/interface/agent-service.interface.ts @@ -165,6 +165,7 @@ export interface IStoreOrgAgentDetails { network?: string; role?: string; did?: string; + didDoc?: string; verkey?: string; isDidPublic?: boolean; agentSpinUpStatus?: number; diff --git a/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts b/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts index 72fb459ea..e26131431 100644 --- a/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts +++ b/apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts @@ -1,19 +1,14 @@ import { trim } from '@credebl/common/cast.helper'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; -import { MaxLength, IsString, MinLength, Matches, IsOptional } from 'class-validator'; +import { MaxLength, IsString, MinLength, IsOptional } from 'class-validator'; import { CreateDidDto } from './create-did.dto'; -const labelRegex = /^[a-zA-Z0-9 ]*$/; export class CreateTenantDto extends CreateDidDto { @ApiProperty() @MaxLength(25, { message: 'Maximum length for label must be 25 characters.' }) @IsString({ message: 'label must be in string format.' }) @Transform(({ value }) => trim(value)) @MinLength(2, { message: 'Minimum length for label must be 2 characters.' }) - @Matches(labelRegex, { message: 'Label must not contain special characters.' }) - @Matches(/^\S*$/, { - message: 'Spaces are not allowed in label' - }) label: string; @ApiProperty({ example: 'ojIckSD2jqNzOqIrAGzL' }) diff --git a/apps/organization/repositories/organization.repository.ts b/apps/organization/repositories/organization.repository.ts index 4aca619cf..261ffb9ab 100644 --- a/apps/organization/repositories/organization.repository.ts +++ b/apps/organization/repositories/organization.repository.ts @@ -391,6 +391,7 @@ export class OrganizationRepository { select: { id: true, orgDid: true, + didDocument: true, walletName: true, agentEndPoint: true, agentSpinUpStatus: true, diff --git a/libs/prisma-service/prisma/migrations/20240315121444_org_agents_did_document/migration.sql b/libs/prisma-service/prisma/migrations/20240315121444_org_agents_did_document/migration.sql new file mode 100644 index 000000000..9c0b9a251 --- /dev/null +++ b/libs/prisma-service/prisma/migrations/20240315121444_org_agents_did_document/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "org_agents" ADD COLUMN "didDocument" JSONB; diff --git a/libs/prisma-service/prisma/schema.prisma b/libs/prisma-service/prisma/schema.prisma index 4663c0569..f0c5492ca 100644 --- a/libs/prisma-service/prisma/schema.prisma +++ b/libs/prisma-service/prisma/schema.prisma @@ -186,6 +186,7 @@ model org_agents { orgId String? @unique @db.Uuid orgAgentTypeId String? @db.Uuid ledgerId String? @db.Uuid + didDocument Json? agent_invitations agent_invitations[] agents agents? @relation(fields: [agentId], references: [id]) agents_type agents_type? @relation(fields: [agentsTypeId], references: [id])