From 043bcac3beb77ebcc8e6b8645a1d9372cc462b3b Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 23 Oct 2024 18:26:02 +0530 Subject: [PATCH] Add method to query deployer by LRN --- packages/backend/src/database.ts | 7 ++++++ packages/backend/src/service.ts | 15 +----------- .../components/projects/create/Configure.tsx | 1 - .../project/overview/Activity/AuctionCard.tsx | 23 +++++++++---------- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/packages/backend/src/database.ts b/packages/backend/src/database.ts index 7cefbaa2..8bf75d32 100644 --- a/packages/backend/src/database.ts +++ b/packages/backend/src/database.ts @@ -592,4 +592,11 @@ export class Database { const deployers = await deployerRepository.find(); return deployers; } + + async getDeployerByLRN(deployerLrn: string): Promise { + const deployerRepository = this.dataSource.getRepository(Deployer); + const deployer = await deployerRepository.findOne({ where: { deployerLrn } }); + + return deployer; + } } diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 2ee14e0a..bcd7e4b8 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -623,7 +623,7 @@ export class Service { let deployer; if (deployerLrn) { - deployer = await this.createDeployerFromLRN(deployerLrn); + deployer = await this.db.getDeployerByLRN(deployerLrn); } else { deployer = data.deployer; } @@ -772,19 +772,6 @@ export class Service { return newDeployment; } - async createDeployerFromLRN(deployerLrn: string): Promise { - const records = await this.laconicRegistry.getRecordsByName(deployerLrn); - - if (records.length === 0) { - log('No records found for deployer LRN:', deployerLrn); - return null; - } - - const deployer = await this.saveDeployersByDeployerRecords(records); - - return deployer[0]; - } - async updateProjectWithDeployer( projectId: string, deployer: Deployer diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index b57abc02..9e6a45a7 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -241,7 +241,6 @@ const Configure = () => { onChange={(event) => onChange(event.target.value)} displayEmpty size='small' - > {deployers.map((deployer) => ( diff --git a/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx b/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx index 5e83d91c..cbf725f8 100644 --- a/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx +++ b/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx @@ -125,6 +125,17 @@ export const AuctionCard = ({ project }: { project: Project }) => { {'\u2022'} {deployer.deployerLrn}

))} + +
+ + Deployer Funds Status + +
+ + {fundsStatus ? 'RELEASED' : 'LOCKED'} + +
+
) : (
@@ -133,20 +144,8 @@ export const AuctionCard = ({ project }: { project: Project }) => {
)} - -
- - Deployer Funds Status - -
- - {fundsStatus ? 'RELEASED' : 'LOCKED'} - -
-
)} -