From 380cc0cba6db1c2a21518579c94aa37564d5e62a Mon Sep 17 00:00:00 2001 From: Neeraj Date: Fri, 18 Oct 2024 13:08:23 +0530 Subject: [PATCH] Update project deployer relation in db --- packages/backend/src/entity/Deployer.ts | 3 +++ packages/backend/src/entity/Project.ts | 8 +++----- packages/backend/src/service.ts | 24 ++++++++++++------------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/packages/backend/src/entity/Deployer.ts b/packages/backend/src/entity/Deployer.ts index 40d91a77..8dc309ec 100644 --- a/packages/backend/src/entity/Deployer.ts +++ b/packages/backend/src/entity/Deployer.ts @@ -10,4 +10,7 @@ export class Deployer { @Column() deployerApiUrl!: string; + + @Column() + baseDomain!: string; } diff --git a/packages/backend/src/entity/Project.ts b/packages/backend/src/entity/Project.ts index d9696767..43b1f759 100644 --- a/packages/backend/src/entity/Project.ts +++ b/packages/backend/src/entity/Project.ts @@ -14,6 +14,7 @@ import { User } from './User'; import { Organization } from './Organization'; import { ProjectMember } from './ProjectMember'; import { Deployment } from './Deployment'; +import { Deployer } from './Deployer'; @Entity() export class Project { @@ -49,8 +50,8 @@ export class Project { @Column('varchar', { nullable: true }) auctionId!: string | null; - @Column({ type: 'simple-array', nullable: true }) - deployerLrns!: string[] | null; + @OneToMany(() => Deployer, (deployer) => deployer.deployerId) + deployers!: Deployer[]; @Column('boolean', { default: false, nullable: true }) fundsReleased!: boolean; @@ -70,9 +71,6 @@ export class Project { @Column('varchar') icon!: string; - @Column({ type: 'simple-array', nullable: true }) - baseDomains!: string[] | null; - @CreateDateColumn() createdAt!: Date; diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 5bf955f6..0ec8849f 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -330,10 +330,10 @@ export class Service { await this.db.addDeployer(deployerData); } - // Update project with deployer LRNs - await this.db.updateProjectById(project.id!, { - deployerLrns - }); + // TODO:Update project with deployer LRNs + // await this.db.updateProjectById(project.id!, { + // deployerLrns + // }); for (const deployer of deployerIds) { log(`Creating deployment for deployer LRN ${deployer}`); @@ -889,7 +889,7 @@ export class Service { await this.updateProject(project.id, { auctionId: applicationDeploymentAuctionId }) } else { await this.createDeployment(user.id, octokit, deploymentData); - await this.updateProject(project.id, { deployerLrns: [lrn!] }) + // await this.updateProject(project.id, { deployerLrns: [lrn!] }) } await this.createRepoHook(octokit, project); @@ -960,13 +960,13 @@ export class Service { }); // TODO: Store deployer in project - const deployers = project.deployerLrns; - if (!deployers) { - log(`No deployer present for project ${project.id}`) - return; - } + // const deployers = project.deployerLrns; + // if (!deployers) { + // log(`No deployer present for project ${project.id}`) + // return; + // } - for (const deployer of deployers) { + // for (const deployer of deployers) { // Create deployment with branch and latest commit in GitHub data await this.createDeployment(project.ownerId, octokit, { @@ -982,7 +982,7 @@ export class Service { // deployer: deployer }, ); - } + // } } }