mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
fix: organization build db connection error
This commit is contained in:
@@ -26,6 +26,7 @@ import { GetCurrentOrganizationService } from './queries/GetCurrentOrganization.
|
||||
import { UpdateOrganizationService } from './commands/UpdateOrganization.service';
|
||||
import { IgnoreTenantInitializedRoute } from '../Tenancy/EnsureTenantIsInitialized.guard';
|
||||
import { IgnoreTenantSeededRoute } from '../Tenancy/EnsureTenantIsSeeded.guards';
|
||||
import { IgnoreTenantModelsInitialize } from '../Tenancy/TenancyInitializeModels.guard';
|
||||
import { GetBuildOrganizationBuildJob } from './commands/GetBuildOrganizationJob.service';
|
||||
import { OrganizationBaseCurrencyLocking } from './Organization/OrganizationBaseCurrencyLocking.service';
|
||||
import {
|
||||
@@ -39,6 +40,7 @@ import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
||||
@Controller('organization')
|
||||
@IgnoreTenantInitializedRoute()
|
||||
@IgnoreTenantSeededRoute()
|
||||
@IgnoreTenantModelsInitialize()
|
||||
@ApiExtraModels(GetCurrentOrganizationResponseDto)
|
||||
@ApiCommonHeaders()
|
||||
export class OrganizationController {
|
||||
@@ -48,7 +50,7 @@ export class OrganizationController {
|
||||
private readonly updateOrganizationService: UpdateOrganizationService,
|
||||
private readonly getBuildOrganizationJobService: GetBuildOrganizationBuildJob,
|
||||
private readonly orgBaseCurrencyLockingService: OrganizationBaseCurrencyLocking,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
@Post('build')
|
||||
@HttpCode(200)
|
||||
|
||||
@@ -23,7 +23,7 @@ export class TenantDBManager {
|
||||
|
||||
@Inject(SystemKnexConnection)
|
||||
private readonly systemKnex: Knex,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Retrieves the tenant database name.
|
||||
@@ -45,8 +45,8 @@ export class TenantDBManager {
|
||||
|
||||
const results = await this.systemKnex.raw(
|
||||
'SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = "' +
|
||||
databaseName +
|
||||
'"',
|
||||
databaseName +
|
||||
'"',
|
||||
);
|
||||
return results[0].length > 0;
|
||||
}
|
||||
@@ -73,12 +73,12 @@ export class TenantDBManager {
|
||||
*/
|
||||
public async dropDatabaseIfExists() {
|
||||
const tenant = await this.tenancyContext.getTenant();
|
||||
const isExists = await this.databaseExists(tenant);
|
||||
const isExists = await this.databaseExists();
|
||||
|
||||
if (!isExists) {
|
||||
return;
|
||||
}
|
||||
await this.dropDatabase(tenant);
|
||||
await this.dropDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ export class TenantDBManager {
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async throwErrorIfTenantDBExists(tenant: TenantModel) {
|
||||
const isExists = await this.databaseExists(tenant);
|
||||
const isExists = await this.databaseExists();
|
||||
if (isExists) {
|
||||
throw new TenantDBAlreadyExists();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user