From f6af3e6a70a324b233f4dea96deb18bda5f17c9e Mon Sep 17 00:00:00 2001 From: Artem Niehrieiev Date: Fri, 3 Apr 2026 09:45:53 +0000 Subject: [PATCH] add hostedDatabaseId to CreateConnectionForHostedDbDto and update use case implementation --- .../create-connecttion-for-selfhosted-db.dto.ts | 5 +++++ .../use-cases/create-connection-for-hosted-db.use.case.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts b/backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts index e4492e18f..e1eb5530e 100644 --- a/backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts +++ b/backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts @@ -61,4 +61,9 @@ export class CreateConnectionForHostedDbDto { @IsString() @IsNotEmpty() password: string; + + @ApiProperty() + @IsString() + @IsNotEmpty() + hostedDatabaseId: string; } diff --git a/backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts b/backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts index 04fdd1081..0f9c7a462 100644 --- a/backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts +++ b/backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts @@ -27,7 +27,7 @@ export class CreateConnectionForHostedDbUseCase } protected async implementation(inputData: CreateConnectionForHostedDbDto): Promise { - const { companyId, userId, databaseName, hostname, port, username, password } = inputData; + const { companyId, userId, databaseName, hostname, port, username, password, hostedDatabaseId } = inputData; const connectionAuthor = await this._dbContext.userRepository.findOneUserById(userId); if (!connectionAuthor) { @@ -63,6 +63,7 @@ export class CreateConnectionForHostedDbUseCase await dao.testConnect(); const connection = new ConnectionEntity(); + connection.id = hostedDatabaseId; connection.type = ConnectionTypesEnum.postgres; connection.host = hostname; connection.port = port;