Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export class GetHostedConnectionCredentialsUseCase
}

protected async implementation(inputData: GetHostedConnectionCredentialsDto): Promise<HostedConnectionCredentialsRO> {
const connection = await this._dbContext.connectionRepository.findOne({
where: { id: inputData.hostedDatabaseId },
});
const connection = await this._dbContext.connectionRepository.findOneConnection(inputData.hostedDatabaseId);
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findOneConnection() has side effects (it generates signing_key when missing and persists the entity) and also loads connection_properties. For a credentials-read use case this introduces an unexpected write + extra join overhead. Prefer using connectionRepository.findOneById(hostedDatabaseId) (it decrypts credentials without mutating) or a dedicated read-only method without the signing_key backfill.

Suggested change
const connection = await this._dbContext.connectionRepository.findOneConnection(inputData.hostedDatabaseId);
const connection = await this._dbContext.connectionRepository.findOneById(inputData.hostedDatabaseId);

Copilot uses AI. Check for mistakes.
if (!connection) {
throw new NotFoundException(Messages.CONNECTION_NOT_FOUND);
}
Expand Down
Loading