-
-
Notifications
You must be signed in to change notification settings - Fork 18
add hostedDatabaseId to CreateConnectionForHostedDbDto and update use case implementation #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ export class CreateConnectionForHostedDbUseCase | |
| } | ||
|
|
||
| protected async implementation(inputData: CreateConnectionForHostedDbDto): Promise<CreatedConnectionResponse> { | ||
| 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; | ||
|
Comment on lines
65
to
67
|
||
| connection.host = hostname; | ||
| connection.port = port; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hostedDatabaseIdis persisted asConnectionEntity.id, which is a varchar with length 38 (ConnectionEntityuses@PrimaryColumn('varchar', { length: 38 })). The DTO currently only validates non-empty string, so oversized values can cause DB errors. Add an explicit length constraint (e.g.,@MaxLength(38)/@Length(...)) and document the expected format in@ApiProperty(description/example), so callers know what to send.