Skip to content

Commit 1230ce8

Browse files
authored
Merge pull request #1701 from rocket-admin/backend_created_db_sync
add hostedDatabaseId to CreateConnectionForHostedDbDto and update use case implementation
2 parents 4e99c4b + f6af3e6 commit 1230ce8

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ export class CreateConnectionForHostedDbDto {
6161
@IsString()
6262
@IsNotEmpty()
6363
password: string;
64+
65+
@ApiProperty()
66+
@IsString()
67+
@IsNotEmpty()
68+
hostedDatabaseId: string;
6469
}

backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class CreateConnectionForHostedDbUseCase
2727
}
2828

2929
protected async implementation(inputData: CreateConnectionForHostedDbDto): Promise<CreatedConnectionResponse> {
30-
const { companyId, userId, databaseName, hostname, port, username, password } = inputData;
30+
const { companyId, userId, databaseName, hostname, port, username, password, hostedDatabaseId } = inputData;
3131

3232
const connectionAuthor = await this._dbContext.userRepository.findOneUserById(userId);
3333
if (!connectionAuthor) {
@@ -63,6 +63,7 @@ export class CreateConnectionForHostedDbUseCase
6363
await dao.testConnect();
6464

6565
const connection = new ConnectionEntity();
66+
connection.id = hostedDatabaseId;
6667
connection.type = ConnectionTypesEnum.postgres;
6768
connection.host = hostname;
6869
connection.port = port;

0 commit comments

Comments
 (0)