From 0341e41c63db24cd2dd6f4cd6efd21d2a410d860 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 10 Oct 2024 10:46:24 +0530 Subject: [PATCH] Update deployments only if valid request Id exists --- packages/backend/src/registry.ts | 3 ++- packages/backend/src/schema.gql | 8 ++++---- packages/backend/src/service.ts | 6 +++++- .../projects/project/overview/Activity/AuctionData.tsx | 4 ++-- .../frontend/src/pages/org-slug/projects/id/Overview.tsx | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/registry.ts b/packages/backend/src/registry.ts index c987dbbf..5f4d432b 100644 --- a/packages/backend/src/registry.ts +++ b/packages/backend/src/registry.ts @@ -473,7 +473,8 @@ export class Registry { } async getAuctionData(auctionId: string): Promise { - const auction = this.registry.getAuctionsByIds([auctionId]); + const auction = await this.registry.getAuctionsByIds([auctionId]); + log({auction}) return auction; } diff --git a/packages/backend/src/schema.gql b/packages/backend/src/schema.gql index ca6d6e47..804eb44a 100644 --- a/packages/backend/src/schema.gql +++ b/packages/backend/src/schema.gql @@ -23,10 +23,10 @@ enum DeploymentStatus { } enum AuctionStatus { - AuctionStatusCommitPhase - AuctionStatusRevealPhase - AuctionStatusExpired - AuctionStatusCompleted + completed + reveal + commit + expired } enum DomainStatus { diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index 14a3660a..91e01ad0 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -173,9 +173,13 @@ export class Service { createdAt: 'DESC', }, }); + const requestRecordIds = new Set(records.map((record) => record.attributes.request).filter(Boolean)); + const filteredDeployments = deployments.filter((deployment) => + deployment.applicationDeploymentRequestId && requestRecordIds.has(deployment.applicationDeploymentRequestId) + ); // Get project IDs of deployments that are in production environment - const productionDeploymentProjectIds = deployments.reduce( + const productionDeploymentProjectIds = filteredDeployments.reduce( (acc, deployment): Set => { if (deployment.environment === Environment.Production) { acc.add(deployment.projectId); diff --git a/packages/frontend/src/components/projects/project/overview/Activity/AuctionData.tsx b/packages/frontend/src/components/projects/project/overview/Activity/AuctionData.tsx index 944a9d98..ed5e626f 100644 --- a/packages/frontend/src/components/projects/project/overview/Activity/AuctionData.tsx +++ b/packages/frontend/src/components/projects/project/overview/Activity/AuctionData.tsx @@ -12,7 +12,7 @@ export const AuctionData = ({ }: { project: Project }) => { - const [isAuctionCompleted, setIsAuctionCompleted] = useState(true); + const [isAuctionCompleted, setIsAuctionCompleted] = useState(false); const client = useGQLClient(); const getIconByAuctionStatus = (isCompleted: Boolean) => { return isCompleted ? : @@ -76,7 +76,7 @@ export const AuctionData = ({ Auction Id: {project.auctionId}

-

+

Deployer LRNs:

diff --git a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx index 01a879fa..080c11e9 100644 --- a/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx +++ b/packages/frontend/src/pages/org-slug/projects/id/Overview.tsx @@ -206,7 +206,7 @@ const OverviewTabPanel = () => { No current deployment found.

)} - + {project.auctionId && }