Skip to content

feat: update delete connection endpoint and add integration tests#1672

Merged
Artuomka merged 1 commit intomainfrom
backend_selfosted_dbs
Mar 17, 2026
Merged

feat: update delete connection endpoint and add integration tests#1672
Artuomka merged 1 commit intomainfrom
backend_selfosted_dbs

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 17, 2026 13:32
@Artuomka Artuomka enabled auto-merge March 17, 2026 13:32
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 end-to-end coverage for the SaaS “hosted connection” create/delete endpoints and adjusts the SaaS controller/DTO to align with the hosted-DB deletion contract.

Changes:

  • Added a new AVA E2E test suite validating hosted connection create/delete flows plus SaaS auth/validation error cases.
  • Updated the SaaS hosted-delete route decorator path.
  • Relaxed hostedDatabaseId validation in the hosted-delete DTO (no longer constrained to UUID).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
backend/test/ava-tests/saas-tests/hosted-connection-e2e.test.ts New E2E tests for /saas/connection/hosted and /saas/connection/hosted/delete, including auth + negative cases.
backend/src/microservices/saas-microservice/saas.controller.ts Adjusts the hosted-delete route decorator path formatting.
backend/src/microservices/saas-microservice/data-structures/delete-connection-for-hosted-db.dto.ts Removes UUID validation for hostedDatabaseId and tweaks Swagger metadata formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +52 to +55
function generateSaasToken(): string {
const jwtSecret = process.env.MICROSERVICE_JWT_SECRET;
return jwt.sign({ request_id: faker.string.uuid() }, jwtSecret, { expiresIn: '1h' });
}
Comment on lines +1 to +28
/* eslint-disable @typescript-eslint/no-unused-vars */
import { faker } from '@faker-js/faker';
import { INestApplication, ValidationPipe } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import test from 'ava';
import { ValidationError } from 'class-validator';
import cookieParser from 'cookie-parser';
import jwt from 'jsonwebtoken';
import request from 'supertest';
import { ApplicationModule } from '../../../src/app.module.js';
import { AccessLevelEnum } from '../../../src/enums/index.js';
import { ValidationException } from '../../../src/exceptions/custom-exceptions/validation-exception.js';
import { Cacher } from '../../../src/helpers/cache/cacher.js';
import { DatabaseModule } from '../../../src/shared/database/database.module.js';
import { DatabaseService } from '../../../src/shared/database/database.service.js';
import { registerUserAndReturnUserInfo } from '../../utils/register-user-and-return-user-info.js';
import { TestUtils } from '../../utils/test.utils.js';

let app: INestApplication;
let _testUtils: TestUtils;
let currentTest: string;

test.before(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [ApplicationModule, DatabaseModule],
providers: [DatabaseService, TestUtils],
}).compile();
_testUtils = moduleFixture.get<TestUtils>(TestUtils);
Comment on lines 21 to 25
@ApiProperty({
description: 'Database name',
example: 'my_database',
example: 'my_database',
})
databaseName: string;
@Artuomka Artuomka merged commit d3db0ad into main Mar 17, 2026
21 of 23 checks passed
@Artuomka Artuomka deleted the backend_selfosted_dbs branch March 17, 2026 13:49
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