From 66a5175dc1abff1477bedc3fd655ecd0ff44faa1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 14 Feb 2023 21:28:58 +0100 Subject: [PATCH 01/41] combine logic for both listTransactionLinks and listTransactionLinksAdmin --- backend/src/graphql/model/TransactionLink.ts | 4 +- .../resolver/TransactionLinkResolver.test.ts | 20 ++-- .../resolver/TransactionLinkResolver.ts | 108 +++++++++--------- backend/src/seeds/graphql/queries.ts | 4 +- frontend/src/graphql/queries.js | 18 +-- 5 files changed, 78 insertions(+), 76 deletions(-) diff --git a/backend/src/graphql/model/TransactionLink.ts b/backend/src/graphql/model/TransactionLink.ts index 18a601948..416527ec9 100644 --- a/backend/src/graphql/model/TransactionLink.ts +++ b/backend/src/graphql/model/TransactionLink.ts @@ -61,8 +61,8 @@ export class TransactionLink { @ObjectType() export class TransactionLinkResult { @Field(() => Int) - linkCount: number + count: number @Field(() => [TransactionLink]) - linkList: TransactionLink[] + links: TransactionLink[] } diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts index 09f2f9a02..03f412a43 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts @@ -611,8 +611,8 @@ describe('TransactionLinkResolver', () => { expect.objectContaining({ data: { listTransactionLinksAdmin: { - linkCount: 6, - linkList: expect.not.arrayContaining([ + count: 6, + links: expect.not.arrayContaining([ expect.objectContaining({ memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(', createdAt: expect.any(String), @@ -647,8 +647,8 @@ describe('TransactionLinkResolver', () => { expect.objectContaining({ data: { listTransactionLinksAdmin: { - linkCount: 6, - linkList: expect.not.arrayContaining([ + count: 6, + links: expect.not.arrayContaining([ expect.objectContaining({ memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(', createdAt: expect.any(String), @@ -681,8 +681,8 @@ describe('TransactionLinkResolver', () => { expect.objectContaining({ data: { listTransactionLinksAdmin: { - linkCount: 7, - linkList: expect.arrayContaining([ + count: 7, + links: expect.arrayContaining([ expect.not.objectContaining({ memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(', createdAt: expect.any(String), @@ -715,8 +715,8 @@ describe('TransactionLinkResolver', () => { expect.objectContaining({ data: { listTransactionLinksAdmin: { - linkCount: 7, - linkList: expect.arrayContaining([ + count: 7, + links: expect.arrayContaining([ expect.objectContaining({ memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(', createdAt: expect.any(String), @@ -752,8 +752,8 @@ describe('TransactionLinkResolver', () => { expect.objectContaining({ data: { listTransactionLinksAdmin: { - linkCount: 6, - linkList: expect.arrayContaining([ + count: 6, + links: expect.arrayContaining([ expect.not.objectContaining({ memo: 'Leider wollte niemand meine Gradidos zum Neujahr haben :(', createdAt: expect.any(String), diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 4647dde60..945ef766c 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -35,6 +35,7 @@ import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' import LogError from '@/server/LogError' import { getLastTransaction } from './util/getLastTransaction' +import { filter } from 'lodash' // TODO: do not export, test it inside the resolver export const transactionLinkCode = (date: Date): string => { @@ -141,30 +142,6 @@ export class TransactionLinkResolver { } } - @Authorized([RIGHTS.LIST_TRANSACTION_LINKS]) - @Query(() => [TransactionLink]) - async listTransactionLinks( - @Args() - { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, - @Ctx() context: Context, - ): Promise { - const user = getUser(context) - // const now = new Date() - const transactionLinks = await DbTransactionLink.find({ - where: { - userId: user.id, - redeemedBy: null, - // validUntil: MoreThan(now), - }, - order: { - createdAt: order, - }, - skip: (currentPage - 1) * pageSize, - take: pageSize, - }) - return transactionLinks.map((tl) => new TransactionLink(tl, new User(user))) - } - @Authorized([RIGHTS.REDEEM_TRANSACTION_LINK]) @Mutation(() => Boolean) async redeemTransactionLink( @@ -338,43 +315,66 @@ export class TransactionLinkResolver { } } + @Authorized([RIGHTS.LIST_TRANSACTION_LINKS]) + @Query(() => [TransactionLink]) + async listTransactionLinks( + @Args() + paginated: Paginated, + @Ctx() context: Context, + ): Promise { + const user = getUser(context) + return transactionLinkList( + paginated, + { + withDeleted: false, + withExpired: true, + withRedeemed: false, + }, + user.id, + ) + } + @Authorized([RIGHTS.LIST_TRANSACTION_LINKS_ADMIN]) @Query(() => TransactionLinkResult) async listTransactionLinksAdmin( @Args() - { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, + paginated: Paginated, @Arg('filters', () => TransactionLinkFilters, { nullable: true }) - filters: TransactionLinkFilters, + filters: TransactionLinkFilters | null, @Arg('userId', () => Int) userId: number, ): Promise { - const user = await DbUser.findOneOrFail({ id: userId }) - const where: { - userId: number - redeemedBy?: number | null - validUntil?: FindOperator | null - } = { - userId, - redeemedBy: null, - validUntil: MoreThan(new Date()), - } - if (filters) { - if (filters.withRedeemed) delete where.redeemedBy - if (filters.withExpired) delete where.validUntil - } - const [transactionLinks, count] = await DbTransactionLink.findAndCount({ - where, - withDeleted: filters ? filters.withDeleted : false, - order: { - createdAt: order, - }, - skip: (currentPage - 1) * pageSize, - take: pageSize, - }) - - return { - linkCount: count, - linkList: transactionLinks.map((tl) => new TransactionLink(tl, new User(user))), - } + return transactionLinkList(paginated, filters, userId) + } +} + +const transactionLinkList = async ( + { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, + filters: TransactionLinkFilters | null, + userId: number, +): Promise => { + const user = await DbUser.findOneOrFail({ id: userId }) + const { withDeleted, withExpired, withRedeemed } = filters || { + withDeleted: false, + withExpired: false, + withRedeemed: false, + } + const [transactionLinks, count] = await DbTransactionLink.findAndCount({ + where: { + userId, + ...(!withRedeemed && { redeemedBy: null }), + ...(!withExpired && { validUntil: MoreThan(new Date()) }), + }, + withDeleted, + order: { + createdAt: order, + }, + skip: (currentPage - 1) * pageSize, + take: pageSize, + }) + + return { + count, + links: transactionLinks.map((tl) => new TransactionLink(tl, new User(user))), } } diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 385a69479..2c4473ab5 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -224,8 +224,8 @@ export const listTransactionLinksAdmin = gql` currentPage: $currentPage pageSize: $pageSize ) { - linkCount - linkList { + count + links { id amount holdAvailableAmount diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index e199a3730..6e8d420b8 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -126,14 +126,16 @@ export const queryTransactionLink = gql` export const listTransactionLinks = gql` query($currentPage: Int = 1, $pageSize: Int = 5) { listTransactionLinks(currentPage: $currentPage, pageSize: $pageSize) { - id - amount - holdAvailableAmount - memo - link - createdAt - validUntil - redeemedAt + links { + id + amount + holdAvailableAmount + memo + link + createdAt + validUntil + redeemedAt + } } } ` From 5bba531769b7da7006f8f5b73a99e474f1f7a7ed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 14 Feb 2023 21:29:14 +0100 Subject: [PATCH 02/41] missing graphql changes --- admin/src/components/TransactionLinkList.spec.js | 4 ++-- admin/src/components/TransactionLinkList.vue | 4 ++-- admin/src/graphql/listTransactionLinksAdmin.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/src/components/TransactionLinkList.spec.js b/admin/src/components/TransactionLinkList.spec.js index 094e515b2..09a7872ca 100644 --- a/admin/src/components/TransactionLinkList.spec.js +++ b/admin/src/components/TransactionLinkList.spec.js @@ -9,8 +9,8 @@ const apolloQueryMock = jest.fn() apolloQueryMock.mockResolvedValue({ data: { listTransactionLinksAdmin: { - linkCount: 8, - linkList: [ + count: 8, + links: [ { amount: '19.99', code: '62ef8236ace7217fbd066c5a', diff --git a/admin/src/components/TransactionLinkList.vue b/admin/src/components/TransactionLinkList.vue index 564865440..eb58903c6 100644 --- a/admin/src/components/TransactionLinkList.vue +++ b/admin/src/components/TransactionLinkList.vue @@ -42,8 +42,8 @@ export default { }, }) .then((result) => { - this.rows = result.data.listTransactionLinksAdmin.linkCount - this.items = result.data.listTransactionLinksAdmin.linkList + this.rows = result.data.listTransactionLinksAdmin.count + this.items = result.data.listTransactionLinksAdmin.links }) .catch((error) => { this.toastError(error.message) diff --git a/admin/src/graphql/listTransactionLinksAdmin.js b/admin/src/graphql/listTransactionLinksAdmin.js index 2e4171f02..c069bafd9 100644 --- a/admin/src/graphql/listTransactionLinksAdmin.js +++ b/admin/src/graphql/listTransactionLinksAdmin.js @@ -8,8 +8,8 @@ export const listTransactionLinksAdmin = gql` userId: $userId filters: { withRedeemed: true, withExpired: true, withDeleted: true } ) { - linkCount - linkList { + count + links { id amount holdAvailableAmount From ae940b509abee4b7d302261bfdbf8b40d69705bf Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 14 Feb 2023 21:33:24 +0100 Subject: [PATCH 03/41] removed unused imports --- backend/src/graphql/resolver/TransactionLinkResolver.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 945ef766c..fb028ca2a 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -1,7 +1,7 @@ import { randomBytes } from 'crypto' import Decimal from 'decimal.js-light' -import { getConnection, MoreThan, FindOperator } from '@dbTools/typeorm' +import { getConnection, MoreThan } from '@dbTools/typeorm' import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink' import { User as DbUser } from '@entity/User' @@ -35,7 +35,6 @@ import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' import LogError from '@/server/LogError' import { getLastTransaction } from './util/getLastTransaction' -import { filter } from 'lodash' // TODO: do not export, test it inside the resolver export const transactionLinkCode = (date: Date): string => { From 12c128e0729b9782854ed269e26f1b4d87c88248 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:03:38 +0100 Subject: [PATCH 04/41] do not requqery the user --- .../src/graphql/resolver/TransactionLinkResolver.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 4bc6721bf..174134aa6 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -333,7 +333,7 @@ export class TransactionLinkResolver { withExpired: true, withRedeemed: false, }, - user.id, + user, ) } @@ -347,16 +347,15 @@ export class TransactionLinkResolver { @Arg('userId', () => Int) userId: number, ): Promise { - return transactionLinkList(paginated, filters, userId) + return transactionLinkList(paginated, filters, await DbUser.findOneOrFail({ id: userId })) } } const transactionLinkList = async ( { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, filters: TransactionLinkFilters | null, - userId: number, + user: DbUser, ): Promise => { - const user = await DbUser.findOneOrFail({ id: userId }) const { withDeleted, withExpired, withRedeemed } = filters || { withDeleted: false, withExpired: false, @@ -364,7 +363,7 @@ const transactionLinkList = async ( } const [transactionLinks, count] = await DbTransactionLink.findAndCount({ where: { - userId, + user: user.id, ...(!withRedeemed && { redeemedBy: null }), ...(!withExpired && { validUntil: MoreThan(new Date()) }), }, @@ -378,6 +377,6 @@ const transactionLinkList = async ( return { count, - links: transactionLinks.map((tl) => new TransactionLink(tl, new User(user))), + links: transactionLinks.map((tl) => new TransactionLink(tl, user)), } } From d21996a045853deea3e29b5ba48a7c67bc1ddf6f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:10:31 +0100 Subject: [PATCH 05/41] externalize transactionLinkList function into utils folder --- .../resolver/TransactionLinkResolver.ts | 34 +---------------- .../resolver/util/transactionLinkList.ts | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 backend/src/graphql/resolver/util/transactionLinkList.ts diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 174134aa6..e0c12d7a7 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -1,7 +1,7 @@ import { randomBytes } from 'crypto' import Decimal from 'decimal.js-light' -import { getConnection, MoreThan } from '@dbTools/typeorm' +import { getConnection } from '@dbTools/typeorm' import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink' import { User as DbUser } from '@entity/User' @@ -13,7 +13,6 @@ import { User } from '@model/User' import { ContributionLink } from '@model/ContributionLink' import { Decay } from '@model/Decay' import { TransactionLink, TransactionLinkResult } from '@model/TransactionLink' -import { Order } from '@enum/Order' import { ContributionType } from '@enum/ContributionType' import { ContributionStatus } from '@enum/ContributionStatus' import { TransactionTypeId } from '@enum/TransactionTypeId' @@ -35,6 +34,7 @@ import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK' import LogError from '@/server/LogError' import { getLastTransaction } from './util/getLastTransaction' +import transactionLinkList from './util/transactionLinkList' // TODO: do not export, test it inside the resolver export const transactionLinkCode = (date: Date): string => { @@ -350,33 +350,3 @@ export class TransactionLinkResolver { return transactionLinkList(paginated, filters, await DbUser.findOneOrFail({ id: userId })) } } - -const transactionLinkList = async ( - { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, - filters: TransactionLinkFilters | null, - user: DbUser, -): Promise => { - const { withDeleted, withExpired, withRedeemed } = filters || { - withDeleted: false, - withExpired: false, - withRedeemed: false, - } - const [transactionLinks, count] = await DbTransactionLink.findAndCount({ - where: { - user: user.id, - ...(!withRedeemed && { redeemedBy: null }), - ...(!withExpired && { validUntil: MoreThan(new Date()) }), - }, - withDeleted, - order: { - createdAt: order, - }, - skip: (currentPage - 1) * pageSize, - take: pageSize, - }) - - return { - count, - links: transactionLinks.map((tl) => new TransactionLink(tl, user)), - } -} diff --git a/backend/src/graphql/resolver/util/transactionLinkList.ts b/backend/src/graphql/resolver/util/transactionLinkList.ts new file mode 100644 index 000000000..48a91920d --- /dev/null +++ b/backend/src/graphql/resolver/util/transactionLinkList.ts @@ -0,0 +1,37 @@ +import { MoreThan } from '@dbTools/typeorm' +import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink' +import { User as DbUser } from '@entity/User' +import { Order } from '@enum/Order' +import Paginated from '@arg/Paginated' +import TransactionLinkFilters from '@arg/TransactionLinkFilters' +import { TransactionLink, TransactionLinkResult } from '@model/TransactionLink' + +export default async function transactionLinkList( + { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, + filters: TransactionLinkFilters | null, + user: DbUser, +): Promise { + const { withDeleted, withExpired, withRedeemed } = filters || { + withDeleted: false, + withExpired: false, + withRedeemed: false, + } + const [transactionLinks, count] = await DbTransactionLink.findAndCount({ + where: { + user: user.id, + ...(!withRedeemed && { redeemedBy: null }), + ...(!withExpired && { validUntil: MoreThan(new Date()) }), + }, + withDeleted, + order: { + createdAt: order, + }, + skip: (currentPage - 1) * pageSize, + take: pageSize, + }) + + return { + count, + links: transactionLinks.map((tl) => new TransactionLink(tl, user)), + } +} From b8870682265d9758013a3beb1716a261360d8fd9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:12:11 +0100 Subject: [PATCH 06/41] remove user constant, not required --- backend/src/graphql/resolver/TransactionLinkResolver.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index e0c12d7a7..186a9bf1d 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -325,7 +325,6 @@ export class TransactionLinkResolver { paginated: Paginated, @Ctx() context: Context, ): Promise { - const user = getUser(context) return transactionLinkList( paginated, { @@ -333,7 +332,7 @@ export class TransactionLinkResolver { withExpired: true, withRedeemed: false, }, - user, + getUser(context), ) } From 16c3ba399e8881f01715ecf0f9dd0f14d1d39df3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:21:37 +0100 Subject: [PATCH 07/41] some misssing changes --- backend/src/graphql/resolver/util/transactionLinkList.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/graphql/resolver/util/transactionLinkList.ts b/backend/src/graphql/resolver/util/transactionLinkList.ts index 48a91920d..2d151b94a 100644 --- a/backend/src/graphql/resolver/util/transactionLinkList.ts +++ b/backend/src/graphql/resolver/util/transactionLinkList.ts @@ -5,6 +5,7 @@ import { Order } from '@enum/Order' import Paginated from '@arg/Paginated' import TransactionLinkFilters from '@arg/TransactionLinkFilters' import { TransactionLink, TransactionLinkResult } from '@model/TransactionLink' +import { User } from '@/graphql/model/User' export default async function transactionLinkList( { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, @@ -18,7 +19,7 @@ export default async function transactionLinkList( } const [transactionLinks, count] = await DbTransactionLink.findAndCount({ where: { - user: user.id, + userId: user.id, ...(!withRedeemed && { redeemedBy: null }), ...(!withExpired && { validUntil: MoreThan(new Date()) }), }, @@ -32,6 +33,6 @@ export default async function transactionLinkList( return { count, - links: transactionLinks.map((tl) => new TransactionLink(tl, user)), + links: transactionLinks.map((tl) => new TransactionLink(tl, new User(user))), } } From c01a94aa248f7660c3d25eb4e9a2dbf3b41db6f8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:25:09 +0100 Subject: [PATCH 08/41] potential frontend fix --- .../src/components/Transactions/TransactionLinkSummary.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.vue b/frontend/src/components/Transactions/TransactionLinkSummary.vue index b54c0e687..f90d6da85 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.vue +++ b/frontend/src/components/Transactions/TransactionLinkSummary.vue @@ -90,7 +90,10 @@ export default { fetchPolicy: 'network-only', }) .then((result) => { - this.transactionLinks = [...this.transactionLinks, ...result.data.listTransactionLinks] + this.transactionLinks.links = [ + ...this.transactionLinks, + ...result.data.listTransactionLinks.links, + ] this.$emit('update-transactions') this.pending = false }) From cb058adde64df26b94aaece5a872f7e7db30a22c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:29:09 +0100 Subject: [PATCH 09/41] fix tests --- .../TransactionLinkSummary.spec.js | 184 +++++++++--------- 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js index d0086ceab..46041f87f 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.spec.js +++ b/frontend/src/components/Transactions/TransactionLinkSummary.spec.js @@ -47,51 +47,53 @@ describe('TransactionLinkSummary', () => { beforeEach(() => { apolloQueryMock.mockResolvedValue({ data: { - listTransactionLinks: [ - { - amount: '75', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 86, - memo: - 'Hokuspokus Haselnuss, Vogelbein und Fliegenfuß, damit der Trick gelingen muss!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '85', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 107, - memo: 'Mäusespeck und Katzenbuckel, Tricks und Tracks und Zauberkugel!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '95', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 92, - memo: - 'Abrakadabra 1,2,3, die Sonne kommt herbei. Schweinepups und Spuckebrei, der Regen ist vorbei.', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '150', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 16, - memo: - 'Abrakadabra 1,2,3 was verschwunden ist komme herbei.Wieseldreck und Schweinemist, zaubern das ist keine List.', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - ], + listTransactionLinks: { + links: [ + { + amount: '75', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 86, + memo: + 'Hokuspokus Haselnuss, Vogelbein und Fliegenfuß, damit der Trick gelingen muss!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '85', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 107, + memo: 'Mäusespeck und Katzenbuckel, Tricks und Tracks und Zauberkugel!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '95', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 92, + memo: + 'Abrakadabra 1,2,3, die Sonne kommt herbei. Schweinepups und Spuckebrei, der Regen ist vorbei.', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '150', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 16, + memo: + 'Abrakadabra 1,2,3 was verschwunden ist komme herbei.Wieseldreck und Schweinemist, zaubern das ist keine List.', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + ], + }, }, }) @@ -166,51 +168,53 @@ describe('TransactionLinkSummary', () => { jest.clearAllMocks() apolloQueryMock.mockResolvedValue({ data: { - listTransactionLinks: [ - { - amount: '76', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 87, - memo: - 'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '86', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 108, - memo: - 'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '96', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 93, - memo: - 'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an – Walpurgisnacht vorüber!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - { - amount: '150', - link: 'http://localhost/redeem/ce28664b5308c17f931c0367', - createdAt: '2022-03-16T14:22:40.000Z', - holdAvailableAmount: '5.13109484759482747111', - id: 17, - memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!', - redeemedAt: null, - validUntil: '2022-03-30T14:22:40.000Z', - }, - ], + listTransactionLinks: { + links: [ + { + amount: '76', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 87, + memo: + 'Hat jemand die Nummer von der Hexe aus Schneewittchen? Ich bräuchte mal ein paar Äpfel.', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '86', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 108, + memo: + 'Die Windfahn´ krächzt am Dach, Der Uhu im Geklüfte; Was wispert wie ein Ach Verhallend in die Lüfte?', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '96', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 93, + memo: + 'Verschlafen kräht der Hahn, Ein Blitz noch, und ein trüber, Umwölbter Tag bricht an – Walpurgisnacht vorüber!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + { + amount: '150', + link: 'http://localhost/redeem/ce28664b5308c17f931c0367', + createdAt: '2022-03-16T14:22:40.000Z', + holdAvailableAmount: '5.13109484759482747111', + id: 17, + memo: 'Eene meene Flaschenschrank, fertig ist der Hexentrank!', + redeemedAt: null, + validUntil: '2022-03-30T14:22:40.000Z', + }, + ], + }, }, }) await wrapper.setData({ From 214970dde186063e48ccae54e0189b8d77e7c37a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 17 Feb 2023 23:38:06 +0100 Subject: [PATCH 10/41] typo --- frontend/src/components/Transactions/TransactionLinkSummary.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Transactions/TransactionLinkSummary.vue b/frontend/src/components/Transactions/TransactionLinkSummary.vue index f90d6da85..c3a62357b 100644 --- a/frontend/src/components/Transactions/TransactionLinkSummary.vue +++ b/frontend/src/components/Transactions/TransactionLinkSummary.vue @@ -90,7 +90,7 @@ export default { fetchPolicy: 'network-only', }) .then((result) => { - this.transactionLinks.links = [ + this.transactionLinks = [ ...this.transactionLinks, ...result.data.listTransactionLinks.links, ] From 3cc549473653142db43f529c9c92cfbd7f559f03 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 20 Feb 2023 14:24:42 +0100 Subject: [PATCH 11/41] refactor(backend): remove admin create contributions --- backend/src/auth/RIGHTS.ts | 1 - .../graphql/model/AdminCreateContributions.ts | 19 ------------- .../graphql/resolver/ContributionResolver.ts | 28 ------------------- 3 files changed, 48 deletions(-) delete mode 100644 backend/src/graphql/model/AdminCreateContributions.ts diff --git a/backend/src/auth/RIGHTS.ts b/backend/src/auth/RIGHTS.ts index 98f6cf118..8b0e82c86 100644 --- a/backend/src/auth/RIGHTS.ts +++ b/backend/src/auth/RIGHTS.ts @@ -42,7 +42,6 @@ export enum RIGHTS { DELETE_USER = 'DELETE_USER', UNDELETE_USER = 'UNDELETE_USER', ADMIN_CREATE_CONTRIBUTION = 'ADMIN_CREATE_CONTRIBUTION', - ADMIN_CREATE_CONTRIBUTIONS = 'ADMIN_CREATE_CONTRIBUTIONS', ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION', ADMIN_DELETE_CONTRIBUTION = 'ADMIN_DELETE_CONTRIBUTION', LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS', diff --git a/backend/src/graphql/model/AdminCreateContributions.ts b/backend/src/graphql/model/AdminCreateContributions.ts deleted file mode 100644 index aa402733a..000000000 --- a/backend/src/graphql/model/AdminCreateContributions.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ObjectType, Field } from 'type-graphql' - -@ObjectType() -export class AdminCreateContributions { - constructor() { - this.success = false - this.successfulContribution = [] - this.failedContribution = [] - } - - @Field(() => Boolean) - success: boolean - - @Field(() => [String]) - successfulContribution: string[] - - @Field(() => [String]) - failedContribution: string[] -} diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index c2f0d7d23..2e3367e1f 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -8,7 +8,6 @@ import { UserContact } from '@entity/UserContact' import { User as DbUser } from '@entity/User' import { Transaction as DbTransaction } from '@entity/Transaction' -import { AdminCreateContributions } from '@model/AdminCreateContributions' import { AdminUpdateContribution } from '@model/AdminUpdateContribution' import { Contribution, ContributionListResult } from '@model/Contribution' import { Decay } from '@model/Decay' @@ -329,33 +328,6 @@ export class ContributionResolver { return getUserCreation(emailContact.userId, clientTimezoneOffset) } - @Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTIONS]) - @Mutation(() => AdminCreateContributions) - async adminCreateContributions( - @Arg('pendingCreations', () => [AdminCreateContributionArgs]) - contributions: AdminCreateContributionArgs[], - @Ctx() context: Context, - ): Promise { - let success = false - const successfulContribution: string[] = [] - const failedContribution: string[] = [] - for (const contribution of contributions) { - await this.adminCreateContribution(contribution, context) - .then(() => { - successfulContribution.push(contribution.email) - success = true - }) - .catch(() => { - failedContribution.push(contribution.email) - }) - } - return { - success, - successfulContribution, - failedContribution, - } - } - @Authorized([RIGHTS.ADMIN_UPDATE_CONTRIBUTION]) @Mutation(() => AdminUpdateContribution) async adminUpdateContribution( From 72165ac99d5418c075c0126534fd3281515c6b69 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 20 Feb 2023 14:39:05 +0100 Subject: [PATCH 12/41] fix test --- .../resolver/ContributionResolver.test.ts | 117 +----------------- 1 file changed, 6 insertions(+), 111 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index b56180c45..de049129a 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -13,7 +13,6 @@ import { denyContribution, confirmContribution, adminCreateContribution, - adminCreateContributions, adminUpdateContribution, adminDeleteContribution, login, @@ -1653,21 +1652,6 @@ describe('ContributionResolver', () => { }) }) - describe('adminCreateContributions', () => { - it('returns an error', async () => { - await expect( - mutate({ - mutation: adminCreateContributions, - variables: { pendingCreations: [variables] }, - }), - ).resolves.toEqual( - expect.objectContaining({ - errors: [new GraphQLError('401 Unauthorized')], - }), - ) - }) - }) - describe('adminUpdateContribution', () => { it('returns an error', async () => { await expect( @@ -1761,21 +1745,6 @@ describe('ContributionResolver', () => { }) }) - describe('adminCreateContributions', () => { - it('returns an error', async () => { - await expect( - mutate({ - mutation: adminCreateContributions, - variables: { pendingCreations: [variables] }, - }), - ).resolves.toEqual( - expect.objectContaining({ - errors: [new GraphQLError('401 Unauthorized')], - }), - ) - }) - }) - describe('adminUpdateContribution', () => { it('returns an error', async () => { await expect( @@ -2120,59 +2089,13 @@ describe('ContributionResolver', () => { }) }) - describe('adminCreateContributions', () => { + describe('adminUpdateContribution', () => { // at this point we have this data in DB: // bibi@bloxberg.de: [1000, 1000, 800] // peter@lustig.de: [1000, 600, 1000] // stephen@hawking.uk: [1000, 1000, 1000] - deleted // garrick@ollivander.com: [1000, 1000, 1000] - not activated - const massCreationVariables = [ - 'bibi@bloxberg.de', - 'peter@lustig.de', - 'stephen@hawking.uk', - 'garrick@ollivander.com', - 'bob@baumeister.de', - ].map((email) => { - return { - email, - amount: new Decimal(500), - memo: 'Grundeinkommen', - creationDate: contributionDateFormatter(new Date()), - } - }) - - it('returns success, two successful creation and three failed creations', async () => { - await expect( - mutate({ - mutation: adminCreateContributions, - variables: { pendingCreations: massCreationVariables }, - }), - ).resolves.toEqual( - expect.objectContaining({ - data: { - adminCreateContributions: { - success: true, - successfulContribution: ['bibi@bloxberg.de', 'peter@lustig.de'], - failedContribution: [ - 'stephen@hawking.uk', - 'garrick@ollivander.com', - 'bob@baumeister.de', - ], - }, - }, - }), - ) - }) - }) - - describe('adminUpdateContribution', () => { - // at this I expect to have this data in DB: - // bibi@bloxberg.de: [1000, 1000, 300] - // peter@lustig.de: [1000, 600, 500] - // stephen@hawking.uk: [1000, 1000, 1000] - deleted - // garrick@ollivander.com: [1000, 1000, 1000] - not activated - describe('user for creation to update does not exist', () => { it('throws an error', async () => { jest.clearAllMocks() @@ -2386,7 +2309,7 @@ describe('ContributionResolver', () => { date: expect.any(String), memo: 'Das war leider zu Viel!', amount: '200', - creation: ['1000', '800', '500'], + creation: ['1000', '800', '1000'], }, }, }), @@ -2424,29 +2347,12 @@ describe('ContributionResolver', () => { memo: 'Das war leider zu Viel!', amount: '200', moderator: admin.id, - creation: ['1000', '800', '500'], - }), - expect.objectContaining({ - id: expect.any(Number), - firstName: 'Peter', - lastName: 'Lustig', - email: 'peter@lustig.de', - date: expect.any(String), - memo: 'Grundeinkommen', - amount: '500', - moderator: admin.id, - creation: ['1000', '800', '500'], + creation: ['1000', '800', '1000'], }), expect.not.objectContaining({ - id: expect.any(Number), - firstName: 'Bibi', - lastName: 'Bloxberg', email: 'bibi@bloxberg.de', - date: expect.any(String), memo: 'Test contribution to delete', amount: '100', - moderator: null, - creation: ['1000', '1000', '90'], }), expect.objectContaining({ id: expect.any(Number), @@ -2457,7 +2363,7 @@ describe('ContributionResolver', () => { memo: 'Test PENDING contribution update', amount: '10', moderator: null, - creation: ['1000', '1000', '90'], + creation: ['1000', '1000', '590'], }), expect.objectContaining({ id: expect.any(Number), @@ -2468,18 +2374,7 @@ describe('ContributionResolver', () => { memo: 'Test IN_PROGRESS contribution', amount: '100', moderator: null, - creation: ['1000', '1000', '90'], - }), - expect.objectContaining({ - id: expect.any(Number), - firstName: 'Bibi', - lastName: 'Bloxberg', - email: 'bibi@bloxberg.de', - date: expect.any(String), - memo: 'Grundeinkommen', - amount: '500', - moderator: admin.id, - creation: ['1000', '1000', '90'], + creation: ['1000', '1000', '590'], }), expect.objectContaining({ id: expect.any(Number), @@ -2490,7 +2385,7 @@ describe('ContributionResolver', () => { memo: 'Aktives Grundeinkommen', amount: '200', moderator: admin.id, - creation: ['1000', '1000', '90'], + creation: ['1000', '1000', '590'], }), ]), }, From 9d60e414adfc4712991d0a004f2061401e4dbfd6 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 20 Feb 2023 14:53:58 +0100 Subject: [PATCH 13/41] remove admin create contributions from admin interface --- admin/src/components/CreationFormular.spec.js | 117 ------------------ admin/src/components/CreationFormular.vue | 97 ++++----------- .../src/components/Tables/SearchUserTable.vue | 1 - admin/src/graphql/adminCreateContributions.js | 11 -- 4 files changed, 26 insertions(+), 200 deletions(-) delete mode 100644 admin/src/graphql/adminCreateContributions.js diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index 6e4c1dc6e..36bfd33f8 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -1,7 +1,6 @@ import { mount } from '@vue/test-utils' import CreationFormular from './CreationFormular.vue' import { adminCreateContribution } from '../graphql/adminCreateContribution' -import { adminCreateContributions } from '../graphql/adminCreateContributions' import { toastErrorSpy, toastSuccessSpy } from '../../test/testSetup' const localVue = global.localVue @@ -328,122 +327,6 @@ describe('CreationFormular', () => { }) }) }) - - describe('mass creation with success', () => { - beforeEach(async () => { - jest.clearAllMocks() - apolloMutateMock.mockResolvedValue({ - data: { - adminCreateContributions: { - success: true, - successfulContribution: ['bob@baumeister.de', 'bibi@bloxberg.de'], - failedContribution: [], - }, - }, - }) - await wrapper.setProps({ - type: 'massCreation', - creation: [200, 400, 600], - items: [{ email: 'bob@baumeister.de' }, { email: 'bibi@bloxberg.de' }], - }) - await wrapper.findAll('input[type="radio"]').at(1).setChecked() - await wrapper.find('textarea').setValue('Test mass create coins') - await wrapper.find('input[type="number"]').setValue(200) - await wrapper.find('.test-submit').trigger('click') - }) - - it('calls the API', () => { - expect(apolloMutateMock).toBeCalledWith( - expect.objectContaining({ - mutation: adminCreateContributions, - variables: { - pendingCreations: [ - { - email: 'bob@baumeister.de', - creationDate: getCreationDate(1), - amount: 200, - memo: 'Test mass create coins', - }, - { - email: 'bibi@bloxberg.de', - creationDate: getCreationDate(1), - amount: 200, - memo: 'Test mass create coins', - }, - ], - }, - }), - ) - }) - - it('updates open creations in store', () => { - expect(stateCommitMock).toBeCalledWith('openCreationsPlus', 2) - }) - - it('emits remove-all-bookmark', () => { - expect(wrapper.emitted('remove-all-bookmark')).toBeTruthy() - }) - }) - - describe('mass creation with success but all failed', () => { - beforeEach(async () => { - jest.clearAllMocks() - apolloMutateMock.mockResolvedValue({ - data: { - adminCreateContributions: { - success: true, - successfulContribution: [], - failedContribution: ['bob@baumeister.de', 'bibi@bloxberg.de'], - }, - }, - }) - await wrapper.setProps({ - type: 'massCreation', - creation: [200, 400, 600], - items: [{ email: 'bob@baumeister.de' }, { email: 'bibi@bloxberg.de' }], - }) - await wrapper.findAll('input[type="radio"]').at(1).setChecked() - await wrapper.find('textarea').setValue('Test mass create coins') - await wrapper.find('input[type="number"]').setValue(200) - await wrapper.find('.test-submit').trigger('click') - }) - - it('updates open creations in store', () => { - expect(stateCommitMock).toBeCalledWith('openCreationsPlus', 0) - }) - - it('emits remove all bookmarks', () => { - expect(wrapper.emitted('remove-all-bookmark')).toBeTruthy() - }) - - it('emits toast failed creations with two emails', () => { - expect(wrapper.emitted('toast-failed-creations')).toEqual([ - [['bob@baumeister.de', 'bibi@bloxberg.de']], - ]) - }) - }) - - describe('mass creation with error', () => { - beforeEach(async () => { - jest.clearAllMocks() - apolloMutateMock.mockRejectedValue({ - message: 'Oh no!', - }) - await wrapper.setProps({ - type: 'massCreation', - creation: [200, 400, 600], - items: [{ email: 'bob@baumeister.de' }, { email: 'bibi@bloxberg.de' }], - }) - await wrapper.findAll('input[type="radio"]').at(1).setChecked() - await wrapper.find('textarea').setValue('Test mass create coins') - await wrapper.find('input[type="number"]').setValue(200) - await wrapper.find('.test-submit').trigger('click') - }) - - it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('Oh no!') - }) - }) }) }) }) diff --git a/admin/src/components/CreationFormular.vue b/admin/src/components/CreationFormular.vue index 2201838de..137b46400 100644 --- a/admin/src/components/CreationFormular.vue +++ b/admin/src/components/CreationFormular.vue @@ -86,16 +86,11 @@ + From cd9d4b301213eeeb57961398b6d959a8d8fa9821 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 23 Feb 2023 22:11:27 +0100 Subject: [PATCH 26/41] remove unused key in locales --- frontend/src/locales/de.json | 1 - frontend/src/locales/en.json | 1 - 2 files changed, 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index c826b9e30..d966e2867 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -214,7 +214,6 @@ "factor": "Faktor", "formula": "Berechnungsformel", "funding": "Zu den Förderbeiträgen", - "gdt": "Gradido Transform", "gdt-received": "Gradido Transform (GDT) erhalten", "gdtKonto": "GDT Konto", "no-transactions": "Du hast noch keine Gradido Transform (GDT).", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 193aff666..a5be6e05b 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -214,7 +214,6 @@ "factor": "Factor", "formula": "Calculation formula", "funding": "To the funding contributions", - "gdt": "Gradido Transform", "gdt-received": "Gradido Transform (GDT) received", "gdtKonto": "GDT Konto", "no-transactions": "You do not have Gradido Transform (GDT) yet.", From 47d720e5a227d43e302a80f6e48b98ae7e69fc57 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 23 Feb 2023 22:16:18 +0100 Subject: [PATCH 27/41] remove px in sidebar --- frontend/src/components/MobileSidebar/MobileSidebar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/MobileSidebar/MobileSidebar.vue b/frontend/src/components/MobileSidebar/MobileSidebar.vue index 0f7a179a9..5bd7c76b6 100644 --- a/frontend/src/components/MobileSidebar/MobileSidebar.vue +++ b/frontend/src/components/MobileSidebar/MobileSidebar.vue @@ -9,7 +9,7 @@ no-header-close > -
+
From affb0fd2b7cc6f24bc676245d5cde9bad6fa851e Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 24 Feb 2023 07:44:58 +0100 Subject: [PATCH 28/41] fix test --- frontend/src/components/Menu/Sidebar.spec.js | 34 ++++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 70d145a9e..27a62ae05 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -34,7 +34,7 @@ describe('Sidebar', () => { describe('the genaral section', () => { it('has five nav-item', () => { - expect(wrapper.findAll('ul').at(0).findAll('.nav-item')).toHaveLength(5) + expect(wrapper.findAll('ul').at(0).findAll('.nav-item')).toHaveLength(6) }) it('has nav-item "navigation.overview" in navbar', () => { @@ -50,34 +50,32 @@ describe('Sidebar', () => { }) it('has nav-item "gdt.gdt" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('gdt.gdt') + expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('creation') }) it('has nav-item "creation" in navbar', () => { - expect(wrapper.findAll('.nav-item').at(4).text()).toContain('creation') + expect(wrapper.findAll('.nav-item').at(4).text()).toContain('GDT') + }) + + it('has nav-item "Information" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(5).text()).toContain('navigation.info') }) }) describe('the specific section', () => { describe('for standard users', () => { it('has three nav-item', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(3) + expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(2) }) it('has nav-item "navigation.info" in navbar', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual( - 'navigation.info', + 'navigation.settings', ) }) it('has nav-item "navigation.settings" in navbar', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual( - 'navigation.settings', - ) - }) - - it('has nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(2).text()).toEqual( 'navigation.logout', ) }) @@ -90,29 +88,23 @@ describe('Sidebar', () => { }) it('has four nav-item', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(4) - }) - - it('has nav-item "navigation.info" in navbar', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual( - 'navigation.info', - ) + expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(3) }) it('has nav-item "navigation.settings" in navbar', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual( + expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(0).text()).toEqual( 'navigation.settings', ) }) it('has nav-item "navigation.admin_area" in navbar', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(2).text()).toEqual( + expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(1).text()).toEqual( 'navigation.admin_area', ) }) it('has nav-item "navigation.logout" in navbar', () => { - expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(3).text()).toEqual( + expect(wrapper.findAll('ul').at(1).findAll('.nav-item').at(2).text()).toEqual( 'navigation.logout', ) }) From 0faf32b071f93881274de923fa299bb5ec99ba51 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 24 Feb 2023 08:08:37 +0100 Subject: [PATCH 29/41] rename files after merge :( --- frontend/public/img/svg/{Community.svg => community.svg} | 0 frontend/src/components/Menu/Sidebar.vue | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename frontend/public/img/svg/{Community.svg => community.svg} (100%) diff --git a/frontend/public/img/svg/Community.svg b/frontend/public/img/svg/community.svg similarity index 100% rename from frontend/public/img/svg/Community.svg rename to frontend/public/img/svg/community.svg diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index a6c0742e2..c6cc4c4e0 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -13,7 +13,7 @@ {{ $t('navigation.overview') }} - + {{ $t('navigation.send') }} From c0f9f07fd8ee823986573c81aac3c3e13f0ba2bc Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 24 Feb 2023 14:00:07 +0100 Subject: [PATCH 30/41] remove further mass creations artefacts --- admin/src/pages/UserSearch.vue | 1 - admin/src/store/store.js | 3 --- admin/src/store/store.test.js | 9 --------- 3 files changed, 13 deletions(-) diff --git a/admin/src/pages/UserSearch.vue b/admin/src/pages/UserSearch.vue index df49526d7..b33633263 100644 --- a/admin/src/pages/UserSearch.vue +++ b/admin/src/pages/UserSearch.vue @@ -72,7 +72,6 @@ export default { return { showArrays: false, searchResult: [], - massCreation: [], criteria: '', filters: { byActivated: null, diff --git a/admin/src/store/store.js b/admin/src/store/store.js index 78fbf21ec..7d43c8ce8 100644 --- a/admin/src/store/store.js +++ b/admin/src/store/store.js @@ -24,9 +24,6 @@ export const mutations = { moderator: (state, moderator) => { state.moderator = moderator }, - setUserSelectedInMassCreation: (state, userSelectedInMassCreation) => { - state.userSelectedInMassCreation = userSelectedInMassCreation - }, } export const actions = { diff --git a/admin/src/store/store.test.js b/admin/src/store/store.test.js index 5ddb048eb..e027ebf1a 100644 --- a/admin/src/store/store.test.js +++ b/admin/src/store/store.test.js @@ -10,7 +10,6 @@ const { resetOpenCreations, setOpenCreations, moderator, - setUserSelectedInMassCreation, } = mutations const { logout } = actions @@ -65,14 +64,6 @@ describe('Vuex store', () => { expect(state.openCreations).toEqual(12) }) }) - - describe('setUserSelectedInMassCreation', () => { - it('sets userSelectedInMassCreation to given value', () => { - const state = { userSelectedInMassCreation: [] } - setUserSelectedInMassCreation(state, [0, 1, 2]) - expect(state.userSelectedInMassCreation).toEqual([0, 1, 2]) - }) - }) }) describe('actions', () => { From 93735ad3f7d1ee24f9219a94fe4268917239ba41 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 17:57:00 +0100 Subject: [PATCH 31/41] rename dht node workflow jobs for github settings --- .github/workflows/test_dht-node.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index 5b3a65a70..f0dc3848e 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -1,4 +1,4 @@ -name: gradido test_dht-node CI +name: Gradido DHT Node Test CI on: push @@ -7,7 +7,7 @@ jobs: # JOB: DOCKER BUILD TEST ##################################################### ############################################################################## build: - name: Docker Build Test + name: Docker Build Test - DHT Node runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,7 +28,7 @@ jobs: # JOB: LINT ################################################################## ############################################################################## lint: - name: Lint + name: Lint - DHT Node runs-on: ubuntu-latest needs: [build] steps: @@ -50,7 +50,7 @@ jobs: # JOB: UNIT TEST ############################################################# ############################################################################## unit_test: - name: Unit tests + name: Unit Tests - DHT Node runs-on: ubuntu-latest needs: [build] steps: From 1f16ae89caa9cd38851f05af8b927884acb51516 Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 21:34:51 +0100 Subject: [PATCH 32/41] rename federation workflow jobs for github settings --- .github/workflows/test_federation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 2da78758e..650fc7347 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -1,4 +1,4 @@ -name: gradido test_federation CI +name: Gradido Federation Test CI on: push @@ -7,7 +7,7 @@ jobs: # JOB: DOCKER BUILD TEST ##################################################### ############################################################################## build: - name: Docker Build Test + name: Docker Build Test - Federation runs-on: ubuntu-latest steps: - name: Checkout code @@ -28,7 +28,7 @@ jobs: # JOB: LINT ################################################################## ############################################################################## lint: - name: Lint + name: Lint - Federation runs-on: ubuntu-latest needs: [build] steps: @@ -50,7 +50,7 @@ jobs: # JOB: UNIT TEST ############################################################# ############################################################################## unit_test: - name: Unit tests + name: Unit Tests - Federation runs-on: ubuntu-latest needs: [build] steps: From eb53e5ff166202b38b5f78a795a579e2416404ab Mon Sep 17 00:00:00 2001 From: mahula Date: Fri, 24 Feb 2023 22:40:07 +0100 Subject: [PATCH 33/41] rename report names in federation and dht workflow --- .github/workflows/test_dht-node.yml | 2 +- .github/workflows/test_federation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht-node.yml index f0dc3848e..4ac475351 100644 --- a/.github/workflows/test_dht-node.yml +++ b/.github/workflows/test_dht-node.yml @@ -90,7 +90,7 @@ jobs: - name: Coverage check uses: webcraftmedia/coverage-check-action@master with: - report_name: Coverage dht-node + report_name: Coverage DHT Node type: lcov #result_path: ./dht-node/coverage/lcov.info result_path: ./coverage/lcov.info diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index 650fc7347..ab943eedd 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -90,7 +90,7 @@ jobs: - name: Coverage check uses: webcraftmedia/coverage-check-action@master with: - report_name: Coverage federation + report_name: Coverage Federation type: lcov #result_path: ./federation/coverage/lcov.info result_path: ./coverage/lcov.info From fc11149f1faed148434225dc314cacf796f14fd9 Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 27 Feb 2023 10:31:10 +0100 Subject: [PATCH 34/41] add visible event an answer question text in my contribution list --- frontend/src/assets/scss/gradido-template.scss | 4 ++++ .../src/components/Contributions/ContributionListItem.vue | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/assets/scss/gradido-template.scss b/frontend/src/assets/scss/gradido-template.scss index 9edb72a4f..5a63d3e78 100644 --- a/frontend/src/assets/scss/gradido-template.scss +++ b/frontend/src/assets/scss/gradido-template.scss @@ -21,6 +21,10 @@ body { padding: 1px; } +.hover-font-bold:hover { + font-weight: bold; +} + .word-break { word-break: break-word; } diff --git a/frontend/src/components/Contributions/ContributionListItem.vue b/frontend/src/components/Contributions/ContributionListItem.vue index 87ffeb682..56b59d55b 100644 --- a/frontend/src/components/Contributions/ContributionListItem.vue +++ b/frontend/src/components/Contributions/ContributionListItem.vue @@ -25,7 +25,11 @@
{{ $t('contributionText') }}
{{ memo }}
-
+
{{ $t('contribution.alert.answerQuestion') }}
From 5f8702c3c4c7010bc3d94ab7642b219cd9d2743c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 27 Feb 2023 15:44:14 +0100 Subject: [PATCH 35/41] catch error for not existing users and test this --- .../resolver/TransactionLinkResolver.test.ts | 20 +++++++++++++++++++ .../resolver/TransactionLinkResolver.ts | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts index 2bbca26d3..60b4551be 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.test.ts @@ -600,6 +600,26 @@ describe('TransactionLinkResolver', () => { resetToken() }) + describe('', () => { + it('throws error when user does not exists', async () => { + jest.clearAllMocks() + await expect( + mutate({ + mutation: listTransactionLinksAdmin, + variables: { + userId: -1, + }, + }), + ).resolves.toMatchObject({ + errors: [new GraphQLError('Could not find requested User')], + }) + }) + + it('logs the error thrown', () => { + expect(logger.error).toBeCalledWith('Could not find requested User', -1) + }) + }) + describe('without any filters', () => { it('finds 6 open transaction links and no deleted or redeemed', async () => { await expect( diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 2c8450bd6..ab5b52bad 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -346,6 +346,10 @@ export class TransactionLinkResolver { @Arg('userId', () => Int) userId: number, ): Promise { - return transactionLinkList(paginated, filters, await DbUser.findOneOrFail({ id: userId })) + const user = await DbUser.findOne({ id: userId }) + if (!user) { + throw new LogError('Could not find requested User', userId) + } + return transactionLinkList(paginated, filters, user) } } From 1055396d20d9bb1530e948fa1822287b959f7a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 28 Feb 2023 14:37:41 +0100 Subject: [PATCH 36/41] Change menu and tab titles in email to the new design --- backend/src/locales/de.json | 6 +++--- backend/src/locales/en.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/locales/de.json b/backend/src/locales/de.json index 530e8db10..4dc90def2 100644 --- a/backend/src/locales/de.json +++ b/backend/src/locales/de.json @@ -17,7 +17,7 @@ "addedContributionMessage": { "commonGoodContributionMessage": "du hast zu deinem Gemeinwohl-Beitrag „{contributionMemo}“ eine Nachricht von {senderFirstName} {senderLastName} erhalten.", "subject": "Gradido: Nachricht zu deinem Gemeinwohl-Beitrag", - "toSeeAndAnswerMessage": "Um die Nachricht zu sehen und darauf zu antworten, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!" + "toSeeAndAnswerMessage": "Um die Nachricht zu sehen und darauf zu antworten, gehe in deinem Gradido-Konto ins Menü „Schöpfen“ auf den Tab „Meine Beiträge“!" }, "contributionConfirmed": { "commonGoodContributionConfirmed": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde soeben von {senderFirstName} {senderLastName} bestätigt und in deinem Gradido-Konto gutgeschrieben.", @@ -26,12 +26,12 @@ "contributionDeleted": { "commonGoodContributionDeleted": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} gelöscht.", "subject": "Gradido: Dein Gemeinwohl-Beitrag wurde gelöscht", - "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!" + "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Schöpfen“ auf den Tab „Meine Beiträge“!" }, "contributionDenied": { "commonGoodContributionDenied": "dein Gemeinwohl-Beitrag „{contributionMemo}“ wurde von {senderFirstName} {senderLastName} abgelehnt.", "subject": "Gradido: Dein Gemeinwohl-Beitrag wurde abgelehnt", - "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Gemeinschaft“ auf den Tab „Meine Beiträge zum Gemeinwohl“!" + "toSeeContributionsAndMessages": "Um deine Gemeinwohl-Beiträge und dazugehörige Nachrichten zu sehen, gehe in deinem Gradido-Konto ins Menü „Schöpfen“ auf den Tab „Meine Beiträge“!" }, "general": { "amountGDD": "Betrag: {amountGDD} GDD", diff --git a/backend/src/locales/en.json b/backend/src/locales/en.json index 269c38629..74c5739bc 100644 --- a/backend/src/locales/en.json +++ b/backend/src/locales/en.json @@ -17,7 +17,7 @@ "addedContributionMessage": { "commonGoodContributionMessage": "you have received a message from {senderFirstName} {senderLastName} regarding your common good contribution “{contributionMemo}”.", "subject": "Gradido: Message about your common good contribution", - "toSeeAndAnswerMessage": "To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!" + "toSeeAndAnswerMessage": "To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!" }, "contributionConfirmed": { "commonGoodContributionConfirmed": "Your public good contribution “{contributionMemo}” has just been confirmed by {senderFirstName} {senderLastName} and credited to your Gradido account.", @@ -26,12 +26,12 @@ "contributionDeleted": { "commonGoodContributionDeleted": "Your public good contribution “{contributionMemo}” was deleted by {senderFirstName} {senderLastName}.", "subject": "Gradido: Your common good contribution was deleted", - "toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!" + "toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!" }, "contributionDenied": { "commonGoodContributionDenied": "Your public good contribution “{contributionMemo}” was rejected by {senderFirstName} {senderLastName}.", "subject": "Gradido: Your common good contribution was rejected", - "toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!" + "toSeeContributionsAndMessages": "To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!" }, "general": { "amountGDD": "Amount: {amountGDD} GDD", From a8d382b8d7f608044b2326af3b5b8528288c8dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 28 Feb 2023 14:37:51 +0100 Subject: [PATCH 37/41] Fix tests --- backend/src/emails/sendEmailVariants.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/emails/sendEmailVariants.test.ts b/backend/src/emails/sendEmailVariants.test.ts index 7e499feb9..9f30a8ce1 100644 --- a/backend/src/emails/sendEmailVariants.test.ts +++ b/backend/src/emails/sendEmailVariants.test.ts @@ -106,7 +106,7 @@ describe('sendEmailVariants', () => { 'you have received a message from Bibi Bloxberg regarding your common good contribution “My contribution.”.', ) expect(result.originalMessage.html).toContain( - 'To view and reply to the message, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!', + 'To view and reply to the message, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!', ) expect(result.originalMessage.html).toContain( `Link to your account: ${CONFIG.EMAIL_LINK_OVERVIEW}`, @@ -424,7 +424,7 @@ describe('sendEmailVariants', () => { 'Your public good contribution “My contribution.” was rejected by Bibi Bloxberg.', ) expect(result.originalMessage.html).toContain( - 'To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!', + 'To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!', ) expect(result.originalMessage.html).toContain( `Link to your account: ${CONFIG.EMAIL_LINK_OVERVIEW}`, @@ -502,7 +502,7 @@ describe('sendEmailVariants', () => { 'Your public good contribution “My contribution.” was deleted by Bibi Bloxberg.', ) expect(result.originalMessage.html).toContain( - 'To see your common good contributions and related messages, go to the “Community” menu in your Gradido account and click on the “My contributions to the common good” tab!', + 'To see your common good contributions and related messages, go to the “Creation” menu in your Gradido account and click on the “My contributions” tab!', ) expect(result.originalMessage.html).toContain( `Link to your account: ${CONFIG.EMAIL_LINK_OVERVIEW}`, From 3a162b358dc4ca93ba19bfdaa8867daf2d506d0c Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 28 Feb 2023 14:49:45 +0100 Subject: [PATCH 38/41] Update frontend/src/components/Menu/Sidebar.spec.js Co-authored-by: Moriz Wahl --- frontend/src/components/Menu/Sidebar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index aded41362..a5447f891 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -33,7 +33,7 @@ describe('Sidebar', () => { }) describe('the genaral section', () => { - it('has five nav-item', () => { + it('has six nav-items', () => { expect(wrapper.findAll('ul').at(0).findAll('.nav-item')).toHaveLength(6) }) From cbc60185954a22259d6daf945ef9fcc889cedb3b Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 28 Feb 2023 14:49:57 +0100 Subject: [PATCH 39/41] Update frontend/src/components/Menu/Sidebar.spec.js Co-authored-by: Moriz Wahl --- frontend/src/components/Menu/Sidebar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index a5447f891..fe8d6525e 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -64,7 +64,7 @@ describe('Sidebar', () => { describe('the specific section', () => { describe('for standard users', () => { - it('has three nav-item', () => { + it('has two nav-items', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(2) }) From 215a77a2dcc10e712a77bd4ae929aa40dfae081f Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Tue, 28 Feb 2023 14:52:41 +0100 Subject: [PATCH 40/41] Update frontend/src/components/Menu/Sidebar.spec.js Co-authored-by: Moriz Wahl --- frontend/src/components/Menu/Sidebar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index fe8d6525e..321d73a3a 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -87,7 +87,7 @@ describe('Sidebar', () => { wrapper = Wrapper() }) - it('has four nav-item', () => { + it('has three nav-items', () => { expect(wrapper.findAll('ul').at(1).findAll('.nav-item')).toHaveLength(3) }) From be048be032dff9a3792a19c43f0d5c8dfb4cf62c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 28 Feb 2023 19:53:35 +0100 Subject: [PATCH 41/41] fix(backend): possible flaky test --- backend/src/graphql/resolver/ContributionResolver.test.ts | 8 ++++---- backend/src/graphql/resolver/util/findContributions.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index a8e36258c..4f574daa9 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -2888,11 +2888,11 @@ describe('ContributionResolver', () => { state: 'PENDING', }), expect.objectContaining({ - amount: '200', - firstName: 'Bibi', + amount: '100', + firstName: 'Peter', id: expect.any(Number), - lastName: 'Bloxberg', - memo: 'Aktives Grundeinkommen', + lastName: 'Lustig', + memo: 'Test env contribution', messagesCount: 0, state: 'PENDING', }), diff --git a/backend/src/graphql/resolver/util/findContributions.ts b/backend/src/graphql/resolver/util/findContributions.ts index 0dc70cf30..84768d399 100644 --- a/backend/src/graphql/resolver/util/findContributions.ts +++ b/backend/src/graphql/resolver/util/findContributions.ts @@ -17,6 +17,7 @@ export const findContributions = async ( withDeleted: withDeleted, order: { createdAt: order, + id: order, }, relations: ['user'], skip: (currentPage - 1) * pageSize,