mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
Merge pull request #831 from bigcapitalhq/fix-tenant-build
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 { UpdateOrganizationService } from './commands/UpdateOrganization.service';
|
||||||
import { IgnoreTenantInitializedRoute } from '../Tenancy/EnsureTenantIsInitialized.guard';
|
import { IgnoreTenantInitializedRoute } from '../Tenancy/EnsureTenantIsInitialized.guard';
|
||||||
import { IgnoreTenantSeededRoute } from '../Tenancy/EnsureTenantIsSeeded.guards';
|
import { IgnoreTenantSeededRoute } from '../Tenancy/EnsureTenantIsSeeded.guards';
|
||||||
|
import { IgnoreTenantModelsInitialize } from '../Tenancy/TenancyInitializeModels.guard';
|
||||||
import { GetBuildOrganizationBuildJob } from './commands/GetBuildOrganizationJob.service';
|
import { GetBuildOrganizationBuildJob } from './commands/GetBuildOrganizationJob.service';
|
||||||
import { OrganizationBaseCurrencyLocking } from './Organization/OrganizationBaseCurrencyLocking.service';
|
import { OrganizationBaseCurrencyLocking } from './Organization/OrganizationBaseCurrencyLocking.service';
|
||||||
import {
|
import {
|
||||||
@@ -39,6 +40,7 @@ import { ApiCommonHeaders } from '@/common/decorators/ApiCommonHeaders';
|
|||||||
@Controller('organization')
|
@Controller('organization')
|
||||||
@IgnoreTenantInitializedRoute()
|
@IgnoreTenantInitializedRoute()
|
||||||
@IgnoreTenantSeededRoute()
|
@IgnoreTenantSeededRoute()
|
||||||
|
@IgnoreTenantModelsInitialize()
|
||||||
@ApiExtraModels(GetCurrentOrganizationResponseDto)
|
@ApiExtraModels(GetCurrentOrganizationResponseDto)
|
||||||
@ApiCommonHeaders()
|
@ApiCommonHeaders()
|
||||||
export class OrganizationController {
|
export class OrganizationController {
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ export class TenantDBManager {
|
|||||||
*/
|
*/
|
||||||
public async dropDatabaseIfExists() {
|
public async dropDatabaseIfExists() {
|
||||||
const tenant = await this.tenancyContext.getTenant();
|
const tenant = await this.tenancyContext.getTenant();
|
||||||
const isExists = await this.databaseExists(tenant);
|
const isExists = await this.databaseExists();
|
||||||
|
|
||||||
if (!isExists) {
|
if (!isExists) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.dropDatabase(tenant);
|
await this.dropDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +115,7 @@ export class TenantDBManager {
|
|||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async throwErrorIfTenantDBExists(tenant: TenantModel) {
|
async throwErrorIfTenantDBExists(tenant: TenantModel) {
|
||||||
const isExists = await this.databaseExists(tenant);
|
const isExists = await this.databaseExists();
|
||||||
if (isExists) {
|
if (isExists) {
|
||||||
throw new TenantDBAlreadyExists();
|
throw new TenantDBAlreadyExists();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user