Refactor VM and Plugin Management
- Removed the `plugins.constants.ts` file as it was no longer needed. - Updated the `vm.class.ts` to improve result handling and logging. - Introduced `vm.constants.ts` to manage registered plugins and modules. - Simplified the test payload in `case1-payload.js` by removing unnecessary insert logic. - Enhanced `case1.ts` to include database and migration setup, improving test clarity. - Deleted unused functions for adding modules and plugins, streamlining the codebase.
This commit is contained in:
@ -57,6 +57,31 @@ export class DatabaseManagerService extends DatabaseEncryptionService {
|
||||
}
|
||||
}
|
||||
|
||||
async getConnectionOptions(projectId: string, queryUser = true) {
|
||||
const project = await this.projectService.findById(projectId);
|
||||
|
||||
if (!project) {
|
||||
throw new Error("Project not found");
|
||||
}
|
||||
|
||||
const database = await this.databaseRepository.findOne({
|
||||
where: { project: { id: project.id } },
|
||||
relations: ["node"],
|
||||
});
|
||||
|
||||
if (!database) {
|
||||
throw new Error("Database not found");
|
||||
}
|
||||
|
||||
return {
|
||||
host: database.node.host,
|
||||
port: database.node.port,
|
||||
user: queryUser ? database.q_username : database.c_username,
|
||||
password: this.decryptPassword(database.password),
|
||||
database: database.database,
|
||||
};
|
||||
}
|
||||
|
||||
async createDatabase(
|
||||
databaseNodeId: string,
|
||||
projectId: string
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { DatabaseManagerModule } from "src/databaseManager/database/database.manager.module";
|
||||
import { forwardRef, Module } from "@nestjs/common";
|
||||
import { MigrationService } from "./migration.service";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
import { Migration } from "../entities/migration.entity";
|
||||
import { DatabaseManagerModule } from "../database.manager.module";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
||||
Reference in New Issue
Block a user