Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SaaS microservice support for creating and deleting “hosted DB” connections via new controller endpoints and use cases.
Changes:
- Introduces DTOs and use cases for creating/deleting hosted DB connections.
- Wires new use cases into
SaasModuleproviders and middleware route protection. - Exposes new SaaS controller endpoints for hosted connection create/delete.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
backend/src/microservices/saas-microservice/use-cases/saas-use-cases.interface.ts |
Adds interfaces for hosted DB connection create/delete use cases. |
backend/src/microservices/saas-microservice/use-cases/create-connection-for-hosted-db.use.case.ts |
Implements hosted DB connection creation (test connect, persist connection/group/permissions). |
backend/src/microservices/saas-microservice/use-cases/delete-connection-for-hosted-db.use.case.ts |
Implements hosted DB connection deletion. |
backend/src/microservices/saas-microservice/saas.module.ts |
Registers new use cases and protects new routes via SaaS auth middleware. |
backend/src/microservices/saas-microservice/saas.controller.ts |
Adds /saas/connection/hosted and /saas/connection/hosted/delete endpoints. |
backend/src/microservices/saas-microservice/data-structures/create-connecttion-for-selfhosted-db.dto.ts |
Adds request DTO for hosted DB connection creation. |
backend/src/microservices/saas-microservice/data-structures/delete-connection-for-hosted-db.dto.ts |
Adds request DTO for hosted DB connection deletion. |
backend/src/common/data-injection.tokens.ts |
Adds DI tokens for the new SaaS hosted DB use cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { UserEntity } from '../../../entities/user/user.entity.js'; | ||
| import { InTransactionEnum } from '../../../enums/in-transaction.enum.js'; | ||
| import { SuccessResponse } from '../data-structures/common-responce.ds.js'; | ||
| import { CreateConnectionForHostedDbDto } from '../data-structures/create-connecttion-for-selfhosted-db.dto.js'; |
Comment on lines
+49
to
+51
| import { CreatedConnectionDTO } from '../../entities/connection/application/dto/created-connection.dto.js'; | ||
| import { CreateConnectionForHostedDbDto } from './data-structures/create-connecttion-for-selfhosted-db.dto.js'; | ||
| import { DeleteConnectionForHostedDbDto } from './data-structures/delete-connection-for-hosted-db.dto.js'; |
Comment on lines
+22
to
+27
|
|
||
| @ApiProperty({ | ||
| description: 'Database name', | ||
| example: 'my_database', | ||
| }) | ||
| databaseName: string; |
| if (!foundCompany) { | ||
| throw new NotFoundException(Messages.COMPANY_NOT_FOUND); | ||
| } | ||
|
|
| protected async implementation(inputData: CreateConnectionForHostedDbDto): Promise<CreatedConnectionDTO> { | ||
| const { companyId, userId, databaseName, hostname, port, username, password } = inputData; | ||
|
|
||
| const connectionAuthor = await this._dbContext.userRepository.findOneUserById(userId); |
Comment on lines
+103
to
+110
| const foundCompany = await this._dbContext.companyInfoRepository.findCompanyInfoByCompanyIdWithoutConnections(companyId); | ||
| if (foundCompany) { | ||
| const connectionToUpdate = await this._dbContext.connectionRepository.findOne({ | ||
| where: { id: savedConnection.id }, | ||
| }); | ||
| connectionToUpdate.company = foundCompany; | ||
| await this._dbContext.connectionRepository.saveUpdatedConnection(connectionToUpdate); | ||
| } |
| @ApiOperation({ summary: 'Delete connection of hosted database' }) | ||
| @ApiBody({ type: DeleteConnectionForHostedDbDto }) | ||
| @ApiResponse({ | ||
| status: 201, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.