Add methods for deployer entity

This commit is contained in:
Adw8 2024-10-17 11:58:27 +05:30 committed by IshaVenikar
parent 510e0de654
commit 4bd111611d

View File

@ -23,6 +23,7 @@ import { EnvironmentVariable } from './entity/EnvironmentVariable';
import { Domain } from './entity/Domain';
import { getEntities, loadAndSaveData } from './utils';
import { UserOrganization } from './entity/UserOrganization';
import { Deployer } from './entity/Deployer';
const ORGANIZATION_DATA_PATH = '../test/fixtures/organizations.json';
@ -573,4 +574,19 @@ export class Database {
return domains;
}
async addDeployer (data: DeepPartial<Deployer>): Promise<Deployer> {
const deployerRepository = this.dataSource.getRepository(Deployer);
const newDomain = await deployerRepository.save(data);
return newDomain;
}
async getDeployerById (deployerId: string): Promise<Deployer | null> {
const deployerRepository = this.dataSource.getRepository(Deployer);
const deployer = await deployerRepository.findOne({ where: { deployerId } });
return deployer;
}
}