From ad3bb58d433251f437b65f8bef2b3df889e85758 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 15:19:29 +0200 Subject: [PATCH 1/5] createContributionLink response contains contribution id --- backend/src/graphql/resolver/AdminResolver.test.ts | 1 + backend/src/seeds/graphql/mutations.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index a1a92dace..06a11d8c2 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -1755,6 +1755,7 @@ describe('AdminResolver', () => { expect.objectContaining({ data: { createContributionLink: expect.objectContaining({ + id: expect.any(Number), amount: '200', code: expect.stringMatching(/^CL-[0-9a-f]{24,24}$/), link: expect.any(String), diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index c0f0fa6e4..253f78e2a 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -159,6 +159,7 @@ export const createContributionLink = gql` maxAmountPerMonth: $maxAmountPerMonth maxPerCycle: $maxPerCycle ) { + id amount name memo From 4d58320426e11980d3078a174c63759db62aa369 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 15:29:10 +0200 Subject: [PATCH 2/5] new backend config version to have COMMUNITY_REDEEM_CONTRIBUTION_URL --- backend/.env.dist | 3 ++- backend/.env.template | 1 + backend/src/config/index.ts | 4 +++- backend/src/graphql/model/ContributionLink.ts | 2 +- deployment/bare_metal/.env.dist | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index 62b786456..41eeeaf58 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -1,4 +1,4 @@ -CONFIG_VERSION=v6.2022-04-21 +CONFIG_VERSION=v7.2022-06-15 # Server PORT=4000 @@ -28,6 +28,7 @@ COMMUNITY_NAME=Gradido Entwicklung COMMUNITY_URL=http://localhost/ COMMUNITY_REGISTER_URL=http://localhost/register COMMUNITY_REDEEM_URL=http://localhost/redeem/{code} +COMMUNITY_REDEEM_CONTRIBUTION_URL=http://localhost/redeem/CL-{code} COMMUNITY_DESCRIPTION=Die lokale Entwicklungsumgebung von Gradido. # Login Server diff --git a/backend/.env.template b/backend/.env.template index 140ec67e9..284abc204 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -27,6 +27,7 @@ COMMUNITY_NAME=$COMMUNITY_NAME COMMUNITY_URL=$COMMUNITY_URL COMMUNITY_REGISTER_URL=$COMMUNITY_REGISTER_URL COMMUNITY_REDEEM_URL=$COMMUNITY_REDEEM_URL +COMMUNITY_REDEEM_CONTRIBUTION_URL=$COMMUNITY_REDEEM_CONTRIBUTION_URL COMMUNITY_DESCRIPTION=$COMMUNITY_DESCRIPTION # Login Server diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 5736e6d8a..dafcd4bf0 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -17,7 +17,7 @@ const constants = { LOG_LEVEL: process.env.LOG_LEVEL || 'info', CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v6.2022-04-21', + EXPECTED: 'v7.2022-06-15', CURRENT: '', }, } @@ -54,6 +54,8 @@ const community = { COMMUNITY_URL: process.env.COMMUNITY_URL || 'http://localhost/', COMMUNITY_REGISTER_URL: process.env.COMMUNITY_REGISTER_URL || 'http://localhost/register', COMMUNITY_REDEEM_URL: process.env.COMMUNITY_REDEEM_URL || 'http://localhost/redeem/{code}', + COMMUNITY_REDEEM_CONTRIBUTION_URL: + process.env.COMMUNITY_REDEEM_CONTRIBUTION_URL || 'http://localhost/redeem/CL-{code}', COMMUNITY_DESCRIPTION: process.env.COMMUNITY_DESCRIPTION || 'Die lokale Entwicklungsumgebung von Gradido.', } diff --git a/backend/src/graphql/model/ContributionLink.ts b/backend/src/graphql/model/ContributionLink.ts index e4b37ad59..87c3f7824 100644 --- a/backend/src/graphql/model/ContributionLink.ts +++ b/backend/src/graphql/model/ContributionLink.ts @@ -18,7 +18,7 @@ export class ContributionLink { this.cycle = contributionLink.cycle this.maxPerCycle = contributionLink.maxPerCycle this.code = 'CL-' + contributionLink.code - this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code) + this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code) } @Field(() => Number) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index a1751a859..d9e159382 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -22,10 +22,11 @@ COMMUNITY_NAME="Gradido Development Stage1" COMMUNITY_URL=https://stage1.gradido.net/ COMMUNITY_REGISTER_URL=https://stage1.gradido.net/register COMMUNITY_REDEEM_URL=https://stage1.gradido.net/redeem/{code} +COMMUNITY_REDEEM_CONTRIBUTION_URL=https://stage1.gradido.net/redeem/CL-{code} COMMUNITY_DESCRIPTION="Gradido Development Stage1 Test Community" # backend -BACKEND_CONFIG_VERSION=v6.2022-04-21 +BACKEND_CONFIG_VERSION=v7.2022-06-15 JWT_EXPIRES_IN=30m GDT_API_URL=https://gdt.gradido.net From fbb629cac5fe9a581280d3e24dc1cbd050c46427 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 15:52:11 +0200 Subject: [PATCH 3/5] remove CL-prefix --- backend/src/graphql/model/ContributionLink.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/model/ContributionLink.ts b/backend/src/graphql/model/ContributionLink.ts index 87c3f7824..9fe9eccd6 100644 --- a/backend/src/graphql/model/ContributionLink.ts +++ b/backend/src/graphql/model/ContributionLink.ts @@ -17,7 +17,7 @@ export class ContributionLink { this.maxAmountPerMonth = contributionLink.maxAmountPerMonth this.cycle = contributionLink.cycle this.maxPerCycle = contributionLink.maxPerCycle - this.code = 'CL-' + contributionLink.code + this.code = contributionLink.code this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code) } From 64a7f4aa6ff9f20b6559c1f5104630caf5ce1956 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 16:04:14 +0200 Subject: [PATCH 4/5] remove CL-prefix for contribution links in tests --- backend/src/graphql/resolver/AdminResolver.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index 06a11d8c2..d55795f6e 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -1757,7 +1757,7 @@ describe('AdminResolver', () => { createContributionLink: expect.objectContaining({ id: expect.any(Number), amount: '200', - code: expect.stringMatching(/^CL-[0-9a-f]{24,24}$/), + code: expect.stringMatching(/^[0-9a-f]{24,24}$/), link: expect.any(String), createdAt: expect.any(String), name: 'Dokumenta 2022', @@ -1809,7 +1809,7 @@ describe('AdminResolver', () => { links: expect.arrayContaining([ expect.objectContaining({ amount: '200', - code: expect.stringMatching(/^CL-[0-9a-f]{24,24}$/), + code: expect.stringMatching(/^[0-9a-f]{24,24}$/), link: expect.any(String), createdAt: expect.any(String), name: 'Dokumenta 2022', @@ -1877,7 +1877,7 @@ describe('AdminResolver', () => { updateContributionLink: { id: linkId, amount: '400', - code: expect.stringMatching(/^CL-[0-9a-f]{24,24}$/), + code: expect.stringMatching(/^[0-9a-f]{24,24}$/), link: expect.any(String), createdAt: expect.any(String), name: 'Dokumenta 2023', From 5b7cb5cdf45e472f12fd8262d7d3548ea216a7fd Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 15 Jun 2022 16:08:16 +0200 Subject: [PATCH 5/5] test CL-prefix on contribution links --- backend/src/graphql/resolver/AdminResolver.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index d55795f6e..7417b529e 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -1758,7 +1758,7 @@ describe('AdminResolver', () => { id: expect.any(Number), amount: '200', code: expect.stringMatching(/^[0-9a-f]{24,24}$/), - link: expect.any(String), + link: expect.stringMatching(/^.*?\/CL-[0-9a-f]{24,24}$/), createdAt: expect.any(String), name: 'Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022', @@ -1810,7 +1810,7 @@ describe('AdminResolver', () => { expect.objectContaining({ amount: '200', code: expect.stringMatching(/^[0-9a-f]{24,24}$/), - link: expect.any(String), + link: expect.stringMatching(/^.*?\/CL-[0-9a-f]{24,24}$/), createdAt: expect.any(String), name: 'Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022', @@ -1878,7 +1878,7 @@ describe('AdminResolver', () => { id: linkId, amount: '400', code: expect.stringMatching(/^[0-9a-f]{24,24}$/), - link: expect.any(String), + link: expect.stringMatching(/^.*?\/CL-[0-9a-f]{24,24}$/), createdAt: expect.any(String), name: 'Dokumenta 2023', memo: 'Danke für deine Teilnahme an der Dokumenta 2023',