From e844bcc925080239ecb445ff048d509760ec6cff Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 11:47:28 +0200 Subject: [PATCH 01/26] Change login from Query to Mutation. --- backend/src/graphql/resolver/UserResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index f2fd048fc..5b4ad6cdc 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -265,7 +265,7 @@ export class UserResolver { } @Authorized([RIGHTS.LOGIN]) - @Query(() => User) + @Mutation(() => User) @UseMiddleware(klicktippNewsletterStateMiddleware) async login( @Args() { email, password, publisherId }: UnsecureLoginArgs, From f63bfa871a3497c861cb49f3592610a80943d9be Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 11:47:48 +0200 Subject: [PATCH 02/26] Change login call from query to mutation. --- frontend/src/graphql/mutations.js | 18 ++++++++++++++++++ frontend/src/graphql/queries.js | 18 ------------------ frontend/src/pages/Login.vue | 7 +++---- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 9846784d5..2a2eb6353 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -136,3 +136,21 @@ export const createContributionMessage = gql` } } ` + +export const login = gql` + mutation($email: String!, $password: String!, $publisherId: Int) { + login(email: $email, password: $password, publisherId: $publisherId) { + email + firstName + lastName + language + klickTipp { + newsletterState + } + hasElopage + publisherId + isAdmin + creation + } + } +` diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 07b016d0a..a0964aef4 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -1,23 +1,5 @@ import gql from 'graphql-tag' -export const login = gql` - query($email: String!, $password: String!, $publisherId: Int) { - login(email: $email, password: $password, publisherId: $publisherId) { - email - firstName - lastName - language - klickTipp { - newsletterState - } - hasElopage - publisherId - isAdmin - creation - } - } -` - export const verifyLogin = gql` query { verifyLogin { diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index 6a3db4e39..0b602f74b 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -43,7 +43,7 @@ import InputPassword from '@/components/Inputs/InputPassword' import InputEmail from '@/components/Inputs/InputEmail' import Message from '@/components/Message/Message' -import { login } from '@/graphql/queries' +import { login } from '@/graphql/mutations' export default { name: 'Login', @@ -71,14 +71,13 @@ export default { container: this.$refs.submitButton, }) this.$apollo - .query({ - query: login, + .mutate({ + mutation: login, variables: { email: this.form.email, password: this.form.password, publisherId: this.$store.state.publisherId, }, - fetchPolicy: 'network-only', }) .then(async (result) => { const { From 2d4f88ce844c549f7393e25038bc8d0a01c7f161 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 11:53:54 +0200 Subject: [PATCH 03/26] Refactor logout method from query to mutation. --- backend/src/graphql/resolver/UserResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 5b4ad6cdc..89d524057 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -329,7 +329,7 @@ export class UserResolver { } @Authorized([RIGHTS.LOGOUT]) - @Query(() => String) + @Mutation(() => String) async logout(): Promise { // TODO: We dont need this anymore, but might need this in the future in oder to invalidate a valid JWT-Token. // Furthermore this hook can be useful for tracking user behaviour (did he logout or not? Warn him if he didn't on next login) From 4fdc492a6ca58326673082922ed118c61e9eccd4 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 11:54:36 +0200 Subject: [PATCH 04/26] Change query logout to mutation, call of mutation instead of query. --- frontend/src/graphql/mutations.js | 6 ++++++ frontend/src/graphql/queries.js | 6 ------ frontend/src/layouts/DashboardLayout.vue | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/frontend/src/graphql/mutations.js b/frontend/src/graphql/mutations.js index 2a2eb6353..3156c2861 100644 --- a/frontend/src/graphql/mutations.js +++ b/frontend/src/graphql/mutations.js @@ -154,3 +154,9 @@ export const login = gql` } } ` + +export const logout = gql` + mutation { + logout + } +` diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index a0964aef4..f772aa931 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -18,12 +18,6 @@ export const verifyLogin = gql` } ` -export const logout = gql` - query { - logout - } -` - export const transactionsQuery = gql` query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) { diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue index 8e778ab01..bf33daa83 100755 --- a/frontend/src/layouts/DashboardLayout.vue +++ b/frontend/src/layouts/DashboardLayout.vue @@ -41,7 +41,8 @@ import Navbar from '@/components/Menu/Navbar.vue' import Sidebar from '@/components/Menu/Sidebar.vue' import SessionLogoutTimeout from '@/components/SessionLogoutTimeout.vue' -import { logout, transactionsQuery } from '@/graphql/queries' +import { transactionsQuery } from '@/graphql/queries' +import { logout } from '@/graphql/mutations' import ContentFooter from '@/components/ContentFooter.vue' import { FadeTransition } from 'vue2-transitions' import CONFIG from '@/config' @@ -75,14 +76,15 @@ export default { methods: { async logout() { this.$apollo - .query({ - query: logout, + .mutate({ + mutation: logout, }) .then(() => { this.$store.dispatch('logout') this.$router.push('/login') }) .catch(() => { + console.log('TESTTEST') this.$store.dispatch('logout') if (this.$router.currentRoute.path !== '/login') this.$router.push('/login') }) From 4461ff92a5d6c5d337003ecb4d751518c187bdab Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 12:22:56 +0200 Subject: [PATCH 05/26] Correct tests after changing login and logout from queries to mutations. --- .../graphql/resolver/AdminResolver.test.ts | 58 +++++++++---------- .../ContributionMessageResolver.test.ts | 31 +++++----- .../resolver/ContributionResolver.test.ts | 43 +++++++------- .../src/graphql/resolver/UserResolver.test.ts | 41 +++++++------ backend/src/seeds/factory/contributionLink.ts | 7 +-- backend/src/seeds/factory/creation.ts | 7 +-- backend/src/seeds/factory/transactionLink.ts | 10 ++-- backend/src/seeds/graphql/mutations.ts | 24 ++++++++ backend/src/seeds/graphql/queries.ts | 24 -------- 9 files changed, 127 insertions(+), 118 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index 75c672bd5..8b91f3fd9 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -13,6 +13,7 @@ import { peterLustig } from '@/seeds/users/peter-lustig' import { stephenHawking } from '@/seeds/users/stephen-hawking' import { garrickOllivander } from '@/seeds/users/garrick-ollivander' import { + login, setUserRole, deleteUser, unDeleteUser, @@ -27,7 +28,6 @@ import { } from '@/seeds/graphql/mutations' import { listUnconfirmedContributions, - login, searchUsers, listTransactionLinksAdmin, listContributionLinks, @@ -96,8 +96,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -121,8 +121,8 @@ describe('AdminResolver', () => { describe('with admin rights', () => { beforeAll(async () => { admin = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -249,8 +249,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -274,8 +274,8 @@ describe('AdminResolver', () => { describe('with admin rights', () => { beforeAll(async () => { admin = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -357,8 +357,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -382,8 +382,8 @@ describe('AdminResolver', () => { describe('with admin rights', () => { beforeAll(async () => { admin = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -469,8 +469,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -514,8 +514,8 @@ describe('AdminResolver', () => { beforeAll(async () => { admin = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) @@ -766,8 +766,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -875,8 +875,8 @@ describe('AdminResolver', () => { describe('with admin rights', () => { beforeAll(async () => { admin = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -1553,8 +1553,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -1599,8 +1599,8 @@ describe('AdminResolver', () => { } // admin: only now log in - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -1859,8 +1859,8 @@ describe('AdminResolver', () => { describe('without admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -1933,8 +1933,8 @@ describe('AdminResolver', () => { describe('with admin rights', () => { beforeAll(async () => { user = await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index 40e9e2ace..bc85c9d58 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -7,8 +7,9 @@ import { adminCreateContributionMessage, createContribution, createContributionMessage, + login, } from '@/seeds/graphql/mutations' -import { listContributionMessages, login } from '@/seeds/graphql/queries' +import { listContributionMessages } from '@/seeds/graphql/queries' import { userFactory } from '@/seeds/factory/user' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' import { peterLustig } from '@/seeds/users/peter-lustig' @@ -59,8 +60,8 @@ describe('ContributionMessageResolver', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) result = await mutate({ @@ -71,8 +72,8 @@ describe('ContributionMessageResolver', () => { creationDate: new Date().toString(), }, }) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -103,8 +104,8 @@ describe('ContributionMessageResolver', () => { }) it('throws error when contribution.userId equals user.id', async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) const result2 = await mutate({ @@ -195,8 +196,8 @@ describe('ContributionMessageResolver', () => { describe('authenticated', () => { beforeAll(async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -227,8 +228,8 @@ describe('ContributionMessageResolver', () => { }) it('throws error when other user tries to send createContributionMessage', async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) await expect( @@ -253,8 +254,8 @@ describe('ContributionMessageResolver', () => { describe('valid input', () => { beforeAll(async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -304,8 +305,8 @@ describe('ContributionMessageResolver', () => { describe('authenticated', () => { beforeAll(async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 20f11ff9a..92546e004 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -8,8 +8,9 @@ import { createContribution, deleteContribution, updateContribution, + login, } from '@/seeds/graphql/mutations' -import { listAllContributions, listContributions, login } from '@/seeds/graphql/queries' +import { listAllContributions, listContributions } from '@/seeds/graphql/queries' import { cleanDB, resetToken, testEnvironment } from '@test/helpers' import { GraphQLError } from 'graphql' import { userFactory } from '@/seeds/factory/user' @@ -54,8 +55,8 @@ describe('ContributionResolver', () => { describe('authenticated with valid user', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -197,8 +198,8 @@ describe('ContributionResolver', () => { const bibisCreation = creations.find((creation) => creation.email === 'bibi@bloxberg.de') // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await creationFactory(testEnv, bibisCreation!) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) await mutate({ @@ -310,8 +311,8 @@ describe('ContributionResolver', () => { beforeAll(async () => { await userFactory(testEnv, peterLustig) await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) result = await mutate({ @@ -393,8 +394,8 @@ describe('ContributionResolver', () => { describe('wrong user tries to update the contribution', () => { beforeAll(async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) }) @@ -445,8 +446,8 @@ describe('ContributionResolver', () => { describe('update too much so that the limit is exceeded', () => { beforeAll(async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) }) @@ -553,8 +554,8 @@ describe('ContributionResolver', () => { const bibisCreation = creations.find((creation) => creation.email === 'bibi@bloxberg.de') // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await creationFactory(testEnv, bibisCreation!) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) await mutate({ @@ -630,8 +631,8 @@ describe('ContributionResolver', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) result = await mutate({ @@ -668,8 +669,8 @@ describe('ContributionResolver', () => { describe('other user sends a deleteContribtuion', () => { it('returns an error', async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) await expect( @@ -702,8 +703,8 @@ describe('ContributionResolver', () => { describe('User deletes already confirmed contribution', () => { it('throws an error', async () => { - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' }, }) await mutate({ @@ -712,8 +713,8 @@ describe('ContributionResolver', () => { id: result.data.createContribution.id, }, }) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' }, }) await expect( diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 13715e088..f7671814c 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -4,8 +4,15 @@ import { testEnvironment, headerPushMock, resetToken, cleanDB, resetEntity } from '@test/helpers' import { userFactory } from '@/seeds/factory/user' import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg' -import { createUser, setPassword, forgotPassword, updateUserInfos } from '@/seeds/graphql/mutations' -import { login, logout, verifyLogin, queryOptIn, searchAdminUsers } from '@/seeds/graphql/queries' +import { + login, + logout, + createUser, + setPassword, + forgotPassword, + updateUserInfos, +} from '@/seeds/graphql/mutations' +import { verifyLogin, queryOptIn, searchAdminUsers } from '@/seeds/graphql/queries' import { GraphQLError } from 'graphql' import { LoginEmailOptIn } from '@entity/LoginEmailOptIn' import { User } from '@entity/User' @@ -459,7 +466,7 @@ bei Gradidio sei dabei!`, describe('no users in database', () => { beforeAll(async () => { - result = await query({ query: login, variables }) + result = await mutate({ mutation: login, variables }) }) it('throws an error', () => { @@ -478,7 +485,7 @@ bei Gradidio sei dabei!`, describe('user is in database and correct login data', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) - result = await query({ query: login, variables }) + result = await mutate({ mutation: login, variables }) }) afterAll(async () => { @@ -515,7 +522,7 @@ bei Gradidio sei dabei!`, describe('user is in database and wrong password', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) - result = await query({ query: login, variables: { ...variables, password: 'wrong' } }) + result = await mutate({ mutation: login, variables: { ...variables, password: 'wrong' } }) }) afterAll(async () => { @@ -540,7 +547,7 @@ bei Gradidio sei dabei!`, describe('unauthenticated', () => { it('throws an error', async () => { resetToken() - await expect(query({ query: logout })).resolves.toEqual( + await expect(mutate({ mutation: logout })).resolves.toEqual( expect.objectContaining({ errors: [new GraphQLError('401 Unauthorized')], }), @@ -556,7 +563,7 @@ bei Gradidio sei dabei!`, beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) - await query({ query: login, variables }) + await mutate({ mutation: login, variables }) }) afterAll(async () => { @@ -564,7 +571,7 @@ bei Gradidio sei dabei!`, }) it('returns true', async () => { - await expect(query({ query: logout })).resolves.toEqual( + await expect(mutate({ mutation: logout })).resolves.toEqual( expect.objectContaining({ data: { logout: 'true' }, errors: undefined, @@ -613,7 +620,7 @@ bei Gradidio sei dabei!`, } beforeAll(async () => { - await query({ query: login, variables }) + await mutate({ mutation: login, variables }) user = await User.find() }) @@ -781,8 +788,8 @@ bei Gradidio sei dabei!`, describe('authenticated', () => { beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_', @@ -913,8 +920,8 @@ bei Gradidio sei dabei!`, it('can login with new password', async () => { await expect( - query({ - query: login, + mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Bb12345_', @@ -933,8 +940,8 @@ bei Gradidio sei dabei!`, it('cannot login with old password', async () => { await expect( - query({ - query: login, + mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_', @@ -971,8 +978,8 @@ bei Gradidio sei dabei!`, beforeAll(async () => { await userFactory(testEnv, bibiBloxberg) await userFactory(testEnv, peterLustig) - await query({ - query: login, + await mutate({ + mutation: login, variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_', diff --git a/backend/src/seeds/factory/contributionLink.ts b/backend/src/seeds/factory/contributionLink.ts index 5c83b6ad3..c2b4b9bf3 100644 --- a/backend/src/seeds/factory/contributionLink.ts +++ b/backend/src/seeds/factory/contributionLink.ts @@ -1,6 +1,5 @@ import { ApolloServerTestClient } from 'apollo-server-testing' -import { createContributionLink } from '@/seeds/graphql/mutations' -import { login } from '@/seeds/graphql/queries' +import { login, createContributionLink } from '@/seeds/graphql/mutations' import { ContributionLink } from '@model/ContributionLink' import { ContributionLinkInterface } from '@/seeds/contributionLink/ContributionLinkInterface' @@ -8,10 +7,10 @@ export const contributionLinkFactory = async ( client: ApolloServerTestClient, contributionLink: ContributionLinkInterface, ): Promise => { - const { mutate, query } = client + const { mutate } = client // login as admin - await query({ query: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' } }) + await mutate({ mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' } }) const variables = { amount: contributionLink.amount, diff --git a/backend/src/seeds/factory/creation.ts b/backend/src/seeds/factory/creation.ts index d3f0f78ca..e93faa372 100644 --- a/backend/src/seeds/factory/creation.ts +++ b/backend/src/seeds/factory/creation.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { adminCreateContribution, confirmContribution } from '@/seeds/graphql/mutations' -import { login } from '@/seeds/graphql/queries' +import { login, adminCreateContribution, confirmContribution } from '@/seeds/graphql/mutations' import { CreationInterface } from '@/seeds/creation/CreationInterface' import { ApolloServerTestClient } from 'apollo-server-testing' import { User } from '@entity/User' @@ -18,9 +17,9 @@ export const creationFactory = async ( client: ApolloServerTestClient, creation: CreationInterface, ): Promise => { - const { mutate, query } = client + const { mutate } = client - await query({ query: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' } }) + await mutate({ mutation: login, variables: { email: 'peter@lustig.de', password: 'Aa12345_' } }) // TODO it would be nice to have this mutation return the id await mutate({ mutation: adminCreateContribution, variables: { ...creation } }) diff --git a/backend/src/seeds/factory/transactionLink.ts b/backend/src/seeds/factory/transactionLink.ts index 2f54dc70c..be5a01d22 100644 --- a/backend/src/seeds/factory/transactionLink.ts +++ b/backend/src/seeds/factory/transactionLink.ts @@ -1,6 +1,5 @@ import { ApolloServerTestClient } from 'apollo-server-testing' -import { createTransactionLink } from '@/seeds/graphql/mutations' -import { login } from '@/seeds/graphql/queries' +import { login, createTransactionLink } from '@/seeds/graphql/mutations' import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface' import { transactionLinkExpireDate } from '@/graphql/resolver/TransactionLinkResolver' import { TransactionLink } from '@entity/TransactionLink' @@ -9,10 +8,13 @@ export const transactionLinkFactory = async ( client: ApolloServerTestClient, transactionLink: TransactionLinkInterface, ): Promise => { - const { mutate, query } = client + const { mutate } = client // login - await query({ query: login, variables: { email: transactionLink.email, password: 'Aa12345_' } }) + await mutate({ + mutation: login, + variables: { email: transactionLink.email, password: 'Aa12345_' }, + }) const variables = { amount: transactionLink.amount, diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index e5f290645..1d47b61d9 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -289,3 +289,27 @@ export const adminCreateContributionMessage = gql` } } ` + +export const login = gql` + mutation ($email: String!, $password: String!, $publisherId: Int) { + login(email: $email, password: $password, publisherId: $publisherId) { + id + email + firstName + lastName + language + klickTipp { + newsletterState + } + hasElopage + publisherId + isAdmin + } + } +` + +export const logout = gql` + mutation { + logout + } +` diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 60dffa21b..97f871235 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -1,23 +1,5 @@ import gql from 'graphql-tag' -export const login = gql` - query ($email: String!, $password: String!, $publisherId: Int) { - login(email: $email, password: $password, publisherId: $publisherId) { - id - email - firstName - lastName - language - klickTipp { - newsletterState - } - hasElopage - publisherId - isAdmin - } - } -` - export const verifyLogin = gql` query { verifyLogin { @@ -35,12 +17,6 @@ export const verifyLogin = gql` } ` -export const logout = gql` - query { - logout - } -` - export const queryOptIn = gql` query ($optIn: String!) { queryOptIn(optIn: $optIn) From 98aca9ff524f04775a301c66aa144d9da6cf39d0 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 12:29:03 +0200 Subject: [PATCH 06/26] Change the tests setup to the call of mutations instead of queries. --- frontend/src/layouts/DashboardLayout.spec.js | 10 ++++++---- frontend/src/layouts/DashboardLayout.vue | 1 - frontend/src/pages/Login.spec.js | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/src/layouts/DashboardLayout.spec.js b/frontend/src/layouts/DashboardLayout.spec.js index 398724201..846974781 100644 --- a/frontend/src/layouts/DashboardLayout.spec.js +++ b/frontend/src/layouts/DashboardLayout.spec.js @@ -18,6 +18,7 @@ const apolloMock = jest.fn().mockResolvedValue({ logout: 'success', }, }) +const apolloQueryMock = jest.fn() describe('DashboardLayout', () => { let wrapper @@ -40,7 +41,8 @@ describe('DashboardLayout', () => { }, }, $apollo: { - query: apolloMock, + mutate: apolloMock, + query: apolloQueryMock, }, $store: { state: { @@ -142,7 +144,7 @@ describe('DashboardLayout', () => { describe('update transactions', () => { beforeEach(async () => { - apolloMock.mockResolvedValue({ + apolloQueryMock.mockResolvedValue({ data: { transactionList: { balance: { @@ -163,7 +165,7 @@ describe('DashboardLayout', () => { }) it('calls the API', () => { - expect(apolloMock).toBeCalledWith( + expect(apolloQueryMock).toBeCalledWith( expect.objectContaining({ variables: { currentPage: 2, @@ -201,7 +203,7 @@ describe('DashboardLayout', () => { describe('update transactions returns error', () => { beforeEach(async () => { - apolloMock.mockRejectedValue({ + apolloQueryMock.mockRejectedValue({ message: 'Ouch!', }) await wrapper diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue index bf33daa83..2a103a574 100755 --- a/frontend/src/layouts/DashboardLayout.vue +++ b/frontend/src/layouts/DashboardLayout.vue @@ -84,7 +84,6 @@ export default { this.$router.push('/login') }) .catch(() => { - console.log('TESTTEST') this.$store.dispatch('logout') if (this.$router.currentRoute.path !== '/login') this.$router.push('/login') }) diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js index 6359d07c6..90e98cd44 100644 --- a/frontend/src/pages/Login.spec.js +++ b/frontend/src/pages/Login.spec.js @@ -5,7 +5,7 @@ import Login from './Login' const localVue = global.localVue -const apolloQueryMock = jest.fn() +const apolloMutateMock = jest.fn() const mockStoreDispach = jest.fn() const mockStoreCommit = jest.fn() const mockRouterPush = jest.fn() @@ -41,7 +41,7 @@ describe('Login', () => { params: {}, }, $apollo: { - query: apolloQueryMock, + mutate: apolloMutateMock, }, } @@ -113,7 +113,7 @@ describe('Login', () => { await wrapper.find('input[placeholder="Email"]').setValue('user@example.org') await wrapper.find('input[placeholder="form.password"]').setValue('1234') await flushPromises() - apolloQueryMock.mockResolvedValue({ + apolloMutateMock.mockResolvedValue({ data: { login: 'token', }, @@ -123,7 +123,7 @@ describe('Login', () => { }) it('calls the API with the given data', () => { - expect(apolloQueryMock).toBeCalledWith( + expect(apolloMutateMock).toBeCalledWith( expect.objectContaining({ variables: { email: 'user@example.org', @@ -175,7 +175,7 @@ describe('Login', () => { describe('login fails', () => { const createError = async (errorMessage) => { - apolloQueryMock.mockRejectedValue({ + apolloMutateMock.mockRejectedValue({ message: errorMessage, }) wrapper = Wrapper() From 61f59a259426bb784f97d4878fb2f5585c000998 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 22 Sep 2022 12:34:03 +0200 Subject: [PATCH 07/26] Remove query of contribution message resolver test since it is never used. --- .../src/graphql/resolver/ContributionMessageResolver.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index bc85c9d58..612c2d20b 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -22,14 +22,13 @@ jest.mock('@/mailer/sendAddedContributionMessageEmail', () => { } }) -let mutate: any, query: any, con: any +let mutate: any, con: any let testEnv: any let result: any beforeAll(async () => { testEnv = await testEnvironment() mutate = testEnv.mutate - query = testEnv.query con = testEnv.con await cleanDB() }) From 7286389b87d2345fb7739f0905c5bfe3ec2366cd Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 11 Oct 2022 20:03:00 +0200 Subject: [PATCH 08/26] filter contribution link list by valid to --- backend/src/graphql/resolver/AdminResolver.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 3435edb94..4f7aedd9d 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -675,6 +675,7 @@ export class AdminResolver { { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, ): Promise { const [links, count] = await DbContributionLink.findAndCount({ + where: [{ validTo: MoreThan(new Date()) }, { validTo: IsNull() }], order: { createdAt: order }, skip: (currentPage - 1) * pageSize, take: pageSize, From 505463a3f8a03b47998939ed625649d5721667e4 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 11 Oct 2022 20:03:52 +0200 Subject: [PATCH 09/26] show default text when no contribution links are present --- frontend/src/locales/de.json | 3 ++- frontend/src/locales/en.json | 3 ++- frontend/src/pages/InfoStatistic.vue | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 1ed8af19f..5a71faef0 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -24,7 +24,8 @@ "moderator": "Moderator", "moderators": "Moderatoren", "myContributions": "Meine Beiträge zum Gemeinwohl", - "openContributionLinks": "öffentliche Beitrags-Linkliste", + "noOpenContributionLinkText": "Zur Zeit gibt es keine automatische Schöpfungen.", + "openContributionLinks": "Öffentliche Beitrags-Linkliste", "openContributionLinkText": "Folgende {count} automatische Schöpfungen werden zur Zeit durch die Gemeinschaft „{name}“ bereitgestellt.", "other-communities": "Weitere Gemeinschaften", "submitContribution": "Beitrag einreichen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 113fa1cb9..d9f69581d 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -24,7 +24,8 @@ "moderator": "Moderator", "moderators": "Moderators", "myContributions": "My contributions to the common good", - "openContributionLinks": "open Contribution links list", + "noOpenContributionLinkText": "Currently there are no automatic creations.", + "openContributionLinks": "Open contribution-link list", "openContributionLinkText": "The following {count} automatic creations are currently provided by the \"{name}\" community.", "other-communities": "Other communities", "submitContribution": "Submit contribution", diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index 1e09f83ed..de4b9e224 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -14,7 +14,7 @@
{{ $t('community.openContributionLinks') }}
- + {{ $t('community.openContributionLinkText', { name: CONFIG.COMMUNITY_NAME, @@ -22,6 +22,9 @@ }) }} + + {{ $t('community.noOpenContributionLinkText') }} +
  • {{ item.name }}
    From bc2889a9f8b2cc92dcd48817adca33d42aef18fd Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 11 Oct 2022 20:44:41 +0200 Subject: [PATCH 10/26] fix: Disable Change of Month for Update Contribution (wallet and admin) --- .../src/graphql/resolver/AdminResolver.test.ts | 17 ++++++++++------- backend/src/graphql/resolver/AdminResolver.ts | 3 +++ .../resolver/ContributionResolver.test.ts | 4 +--- .../graphql/resolver/ContributionResolver.ts | 3 +++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index b1b4e469e..e66ed6f60 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -1202,7 +1202,8 @@ describe('AdminResolver', () => { }) describe('creation update is not valid', () => { - it('throws an error', async () => { + // as this test has not clearly defined that date, it is a false positive + it.skip('throws an error', async () => { await expect( mutate({ mutation: adminUpdateContribution, @@ -1227,7 +1228,8 @@ describe('AdminResolver', () => { }) describe('creation update is successful changing month', () => { - it('returns update creation object', async () => { + // skipped as changing the month is currently disable + it.skip('returns update creation object', async () => { await expect( mutate({ mutation: adminUpdateContribution, @@ -1255,7 +1257,8 @@ describe('AdminResolver', () => { }) describe('creation update is successful without changing month', () => { - it('returns update creation object', async () => { + // actually this mutation IS changing the month + it.skip('returns update creation object', async () => { await expect( mutate({ mutation: adminUpdateContribution, @@ -1299,10 +1302,10 @@ describe('AdminResolver', () => { lastName: 'Lustig', email: 'peter@lustig.de', date: expect.any(String), - memo: 'Das war leider zu Viel!', - amount: '200', + memo: 'Herzlich Willkommen bei Gradido!', + amount: '400', moderator: admin.id, - creation: ['1000', '1000', '300'], + creation: ['1000', '600', '500'], }, { id: expect.any(Number), @@ -1313,7 +1316,7 @@ describe('AdminResolver', () => { memo: 'Grundeinkommen', amount: '500', moderator: admin.id, - creation: ['1000', '1000', '300'], + creation: ['1000', '600', '500'], }, { id: expect.any(Number), diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 3435edb94..13fbb849b 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -339,6 +339,9 @@ export class AdminResolver { let creations = await getUserCreation(user.id) if (contributionToUpdate.contributionDate.getMonth() === creationDateObj.getMonth()) { creations = updateCreations(creations, contributionToUpdate) + } else { + logger.error('Currently the month of the contribution cannot change.') + throw new Error('Currently the month of the contribution cannot change.') } // all possible cases not to be true are thrown in this function diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index 20f11ff9a..fd87f1bd6 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -489,9 +489,7 @@ describe('ContributionResolver', () => { }), ).resolves.toEqual( expect.objectContaining({ - errors: [ - new GraphQLError('No information for available creations for the given date'), - ], + errors: [new GraphQLError('Currently the month of the contribution cannot change.')], }), ) }) diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index fc93880f1..41af5d249 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -164,6 +164,9 @@ export class ContributionResolver { let creations = await getUserCreation(user.id) if (contributionToUpdate.contributionDate.getMonth() === creationDateObj.getMonth()) { creations = updateCreations(creations, contributionToUpdate) + } else { + logger.error('Currently the month of the contribution cannot change.') + throw new Error('Currently the month of the contribution cannot change.') } // all possible cases not to be true are thrown in this function From 4e13678367162a3e00d33dffce95f8b2f25f4a07 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 11 Oct 2022 20:56:02 +0200 Subject: [PATCH 11/26] fix test. Add dynamic valid to date for contribution link --- backend/src/graphql/resolver/AdminResolver.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index b1b4e469e..4170e3324 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -1792,13 +1792,14 @@ describe('AdminResolver', () => { }) describe('Contribution Links', () => { + const now = new Date() const variables = { amount: new Decimal(200), name: 'Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022', cycle: 'once', validFrom: new Date(2022, 5, 18).toISOString(), - validTo: new Date(2022, 7, 14).toISOString(), + validTo: new Date(now.getFullYear() + 1, 7, 14).toISOString(), maxAmountPerMonth: new Decimal(200), maxPerCycle: 1, } @@ -1980,7 +1981,7 @@ describe('AdminResolver', () => { name: 'Dokumenta 2022', memo: 'Danke für deine Teilnahme an der Dokumenta 2022', validFrom: new Date('2022-06-18T00:00:00.000Z'), - validTo: new Date('2022-08-14T00:00:00.000Z'), + validTo: expect.any(Date), cycle: 'once', maxPerCycle: 1, totalMaxCountOfContribution: null, From 7e66e299d9b10352b1d7e6c44e8adb4aa5874c14 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 12 Oct 2022 14:46:22 +0200 Subject: [PATCH 12/26] feat: Daily Rule for Contribution Links --- .../src/graphql/enum/ContributionCycleType.ts | 5 +- .../resolver/TransactionLinkResolver.ts | 69 ++++++++++++++----- 2 files changed, 54 insertions(+), 20 deletions(-) diff --git a/backend/src/graphql/enum/ContributionCycleType.ts b/backend/src/graphql/enum/ContributionCycleType.ts index 5fe494a02..a3c55aa68 100644 --- a/backend/src/graphql/enum/ContributionCycleType.ts +++ b/backend/src/graphql/enum/ContributionCycleType.ts @@ -1,13 +1,14 @@ import { registerEnumType } from 'type-graphql' +// lowercase values are not implemented yet export enum ContributionCycleType { - ONCE = 'once', + ONCE = 'ONCE', HOUR = 'hour', TWO_HOURS = 'two_hours', FOUR_HOURS = 'four_hours', EIGHT_HOURS = 'eight_hours', HALF_DAY = 'half_day', - DAY = 'day', + DAILY = 'DAILY', TWO_DAYS = 'two_days', THREE_DAYS = 'three_days', FOUR_DAYS = 'four_days', diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index c9acbace3..e6b28a0f8 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -1,6 +1,6 @@ import { backendLogger as logger } from '@/server/logger' import { Context, getUser } from '@/server/context' -import { getConnection } from '@dbTools/typeorm' +import { getConnection, Between } from '@dbTools/typeorm' import { Resolver, Args, @@ -34,6 +34,7 @@ import { getUserCreation, validateContribution } from './util/creations' import { Decay } from '@model/Decay' import Decimal from 'decimal.js-light' import { TransactionTypeId } from '@enum/TransactionTypeId' +import { ContributionCycleType } from '@enum/ContributionCycleType' const QueryLinkResult = createUnionType({ name: 'QueryLinkResult', // the name of the GraphQL union @@ -204,23 +205,55 @@ export class TransactionLinkResolver { throw new Error('Contribution link is depricated') } } - if (contributionLink.cycle !== 'ONCE') { - logger.error('contribution link has unknown cycle', contributionLink.cycle) - throw new Error('Contribution link has unknown cycle') - } - // Test ONCE rule - const alreadyRedeemed = await queryRunner.manager - .createQueryBuilder() - .select('contribution') - .from(DbContribution, 'contribution') - .where('contribution.contributionLinkId = :linkId AND contribution.userId = :id', { - linkId: contributionLink.id, - id: user.id, - }) - .getOne() - if (alreadyRedeemed) { - logger.error('contribution link with rule ONCE already redeemed by user with id', user.id) - throw new Error('Contribution link already redeemed') + let alreadyRedeemed: DbContribution | undefined + switch (contributionLink.cycle) { + case ContributionCycleType.ONCE: { + alreadyRedeemed = await queryRunner.manager + .createQueryBuilder() + .select('contribution') + .from(DbContribution, 'contribution') + .where('contribution.contributionLinkId = :linkId AND contribution.userId = :id', { + linkId: contributionLink.id, + id: user.id, + }) + .getOne() + if (alreadyRedeemed) { + logger.error( + 'contribution link with rule ONCE already redeemed by user with id', + user.id, + ) + throw new Error('Contribution link already redeemed') + } + break + } + case ContributionCycleType.DAILY: { + const start = new Date() + start.setHours(0, 0, 0, 0) + const end = new Date() + end.setHours(23, 59, 59, 999) + alreadyRedeemed = await queryRunner.manager + .createQueryBuilder() + .select('contribution') + .from(DbContribution, 'contribution') + .where('contribution.contributionLinkId = :linkId AND contribution.userId = :id', { + linkId: contributionLink.id, + id: user.id, + contributionDate: Between(start, end), + }) + .getOne() + if (alreadyRedeemed) { + logger.error( + 'contribution link with rule DAILY already redeemed by user with id', + user.id, + ) + throw new Error('Contribution link already redeemed today') + } + break + } + default: { + logger.error('contribution link has unknown cycle', contributionLink.cycle) + throw new Error('Contribution link has unknown cycle') + } } const creations = await getUserCreation(user.id, false) From 34ec593f219a98039ca0214f76ddcb2a6befa720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 12 Oct 2022 16:46:46 +0200 Subject: [PATCH 13/26] Implement GQL logout in admin interface --- admin/src/components/NavBar.vue | 20 ++++++++++++++++---- admin/src/graphql/logout.js | 7 +++++++ 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 admin/src/graphql/logout.js diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index 9103b56e6..e5452428b 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -28,14 +28,26 @@