Skip to content

Backend selfosted dbs#1669

Merged
Artuomka merged 2 commits intomainfrom
backend_selfosted_dbs
Mar 16, 2026
Merged

Backend selfosted dbs#1669
Artuomka merged 2 commits intomainfrom
backend_selfosted_dbs

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 16, 2026 16:12
@Artuomka Artuomka enabled auto-merge March 16, 2026 16:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 SaasModule providers 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,
@Artuomka Artuomka merged commit 1ac9111 into main Mar 16, 2026
21 of 23 checks passed
@Artuomka Artuomka deleted the backend_selfosted_dbs branch March 16, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants