From a2ad9911e825c8bad325ff1b1134167880fc5450 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Fri, 9 Aug 2024 16:12:08 -0300 Subject: [PATCH 1/6] fix: remove cost id from create quote metric --- react/utils/metrics/createQuote.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/react/utils/metrics/createQuote.ts b/react/utils/metrics/createQuote.ts index c5ee173..2635793 100644 --- a/react/utils/metrics/createQuote.ts +++ b/react/utils/metrics/createQuote.ts @@ -12,7 +12,6 @@ const GRAPHQL_URL = (accountName: string, workspace?: string) => { } type CreateQuoteFieldsMetric = { - cost_center_id: string cost_center_name: string buyer_org_id: string buyer_org_name: string @@ -38,11 +37,10 @@ type CreateQuoteMetric = Metric & { fields: CreateQuoteFieldsMetric } const fetchMetricsData = async ( accountName: string, workspace: string, - quoteId: string, - userEmail: string + quoteId: string ) => { const query = JSON.stringify({ - query: `query GetMetricsData($id: String, $email: String!) { + query: `query GetMetricsData($id: String) { getQuote(id: $id) @context(provider: "vtex.b2b-quotes-graphql") { organization organizationName @@ -50,12 +48,9 @@ const fetchMetricsData = async ( referenceName creatorRole creationDate - }, - getUserByEmail(email: $email) @context(provider: "vtex.storefront-permissions") { - costId - } - }`, - variables: { id: quoteId, email: userEmail }, + } + }`, + variables: { id: quoteId}, }) const { data, errors } = ( @@ -67,12 +62,10 @@ const fetchMetricsData = async ( throw new Error('Graphql Errors when trying get quote and user data') } - const quoteResult = data?.getQuote as Omit - const costId = (data?.getUserByEmail?.[0].costId ?? '') as string + const quoteResult = data?.getQuote as QuoteMetricsData return { ...quoteResult, - costId, } } @@ -85,8 +78,7 @@ const buildCreateQuoteMetric = async ( const metricsData = await fetchMetricsData( metricsParam.account, metricsParam.workspace, - metricsParam.quoteId, - userEmail + metricsParam.quoteId ) const metric: CreateQuoteMetric = { @@ -97,7 +89,6 @@ const buildCreateQuoteMetric = async ( fields: { buyer_org_id: metricsData.organization, buyer_org_name: metricsData.organizationName, - cost_center_id: metricsData.costId, cost_center_name: metricsData.costCenterName, member_id: namespaces?.profile?.id?.value, member_email: userEmail, @@ -115,7 +106,6 @@ const buildCreateQuoteMetric = async ( type QuoteMetricsData = { organization: string // organizationId organizationName: string - costId: string costCenterName: string referenceName: string // quote reference name creatorRole: string From 9462e417a0f8b845f36452d433e7d2f3a00ec548 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Tue, 13 Aug 2024 10:23:07 -0300 Subject: [PATCH 2/6] fix: update change log --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5579c9e..4af712a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed +- Removed cost center id from metrics + ## [1.6.1] - 2024-06-20 ### Fixed From 9fb1f1d5afd426f1a325eb411341a12d95eaf7d1 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Tue, 13 Aug 2024 11:21:58 -0300 Subject: [PATCH 3/6] fix: improve code --- react/utils/metrics/createQuote.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/react/utils/metrics/createQuote.ts b/react/utils/metrics/createQuote.ts index 2635793..3f7bcb3 100644 --- a/react/utils/metrics/createQuote.ts +++ b/react/utils/metrics/createQuote.ts @@ -62,11 +62,7 @@ const fetchMetricsData = async ( throw new Error('Graphql Errors when trying get quote and user data') } - const quoteResult = data?.getQuote as QuoteMetricsData - - return { - ...quoteResult, - } + return data?.getQuote as QuoteMetricsData } const buildCreateQuoteMetric = async ( From 0acb329d32f093d3d2eca18fe1b3be0d5480dfe7 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Tue, 13 Aug 2024 15:08:47 -0300 Subject: [PATCH 4/6] fix: lint error --- react/utils/metrics/createQuote.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/utils/metrics/createQuote.ts b/react/utils/metrics/createQuote.ts index 3f7bcb3..bf9ec5e 100644 --- a/react/utils/metrics/createQuote.ts +++ b/react/utils/metrics/createQuote.ts @@ -50,7 +50,7 @@ const fetchMetricsData = async ( creationDate } }`, - variables: { id: quoteId}, + variables: { id: quoteId }, }) const { data, errors } = ( From 22f7e31b7d5292cd7313a765745e254329803a97 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Thu, 15 Aug 2024 09:25:14 -0300 Subject: [PATCH 5/6] fix: sonar issue --- .github/workflows/qe-pull-request-target.yml | 2 +- .github/workflows/qe-pull-request.yml | 2 +- .github/workflows/qe-push.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/qe-pull-request-target.yml b/.github/workflows/qe-pull-request-target.yml index cb2cfb8..e6b1f85 100644 --- a/.github/workflows/qe-pull-request-target.yml +++ b/.github/workflows/qe-pull-request-target.yml @@ -11,7 +11,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 with: danger: true dangerRequireChangelog: false diff --git a/.github/workflows/qe-pull-request.yml b/.github/workflows/qe-pull-request.yml index 0456448..cf71ddc 100644 --- a/.github/workflows/qe-pull-request.yml +++ b/.github/workflows/qe-pull-request.yml @@ -14,7 +14,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 with: danger: true dangerRequireChangelog: false diff --git a/.github/workflows/qe-push.yml b/.github/workflows/qe-push.yml index ec7b2d6..4c30379 100644 --- a/.github/workflows/qe-push.yml +++ b/.github/workflows/qe-push.yml @@ -9,7 +9,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 with: nodeLint: true nodeTest: false From 7073c1d5587c64f31b9e05f5d745a46913b2cc03 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti Date: Thu, 15 Aug 2024 09:29:54 -0300 Subject: [PATCH 6/6] Revert "fix: sonar issue" This reverts commit 22f7e31b7d5292cd7313a765745e254329803a97. --- .github/workflows/qe-pull-request-target.yml | 2 +- .github/workflows/qe-pull-request.yml | 2 +- .github/workflows/qe-push.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/qe-pull-request-target.yml b/.github/workflows/qe-pull-request-target.yml index e6b1f85..cb2cfb8 100644 --- a/.github/workflows/qe-pull-request-target.yml +++ b/.github/workflows/qe-pull-request-target.yml @@ -11,7 +11,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 with: danger: true dangerRequireChangelog: false diff --git a/.github/workflows/qe-pull-request.yml b/.github/workflows/qe-pull-request.yml index cf71ddc..0456448 100644 --- a/.github/workflows/qe-pull-request.yml +++ b/.github/workflows/qe-pull-request.yml @@ -14,7 +14,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 with: danger: true dangerRequireChangelog: false diff --git a/.github/workflows/qe-push.yml b/.github/workflows/qe-push.yml index 4c30379..ec7b2d6 100644 --- a/.github/workflows/qe-push.yml +++ b/.github/workflows/qe-push.yml @@ -9,7 +9,7 @@ on: jobs: quality-engineering: name: QE - uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2.1.14 + uses: vtex-apps/usqa/.github/workflows/quality-engineering.yml@v2 with: nodeLint: true nodeTest: false