From 66a5175dc1abff1477bedc3fd655ecd0ff44faa1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 14 Feb 2023 21:28:58 +0100 Subject: [PATCH 01/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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 75d23c5dafea30967d0a5bbf498c014beab86ee3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 23 Feb 2023 21:36:59 +0100 Subject: [PATCH 11/27] corrected return type of listTransactionLinks --- backend/src/graphql/resolver/TransactionLinkResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/TransactionLinkResolver.ts b/backend/src/graphql/resolver/TransactionLinkResolver.ts index 186a9bf1d..2c8450bd6 100644 --- a/backend/src/graphql/resolver/TransactionLinkResolver.ts +++ b/backend/src/graphql/resolver/TransactionLinkResolver.ts @@ -319,7 +319,7 @@ export class TransactionLinkResolver { } @Authorized([RIGHTS.LIST_TRANSACTION_LINKS]) - @Query(() => [TransactionLink]) + @Query(() => TransactionLinkResult) async listTransactionLinks( @Args() paginated: Paginated, From a1b926da711215a4b12a51bc66f72632e486f074 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 23 Feb 2023 22:01:30 +0100 Subject: [PATCH 12/27] style sidebar, add icons --- frontend/public/img/svg/Community.svg | 103 ++++++++++ frontend/public/img/svg/home.svg | 29 +++ frontend/public/img/svg/info.svg | 182 ++++++++++++++++++ frontend/public/img/svg/lines.png | Bin 0 -> 793 bytes frontend/public/img/svg/logout.svg | 162 ++++++++++++++++ frontend/public/img/svg/send.svg | 114 +++++++++++ frontend/public/img/svg/settings.svg | 152 +++++++++++++++ frontend/public/img/svg/transaction.svg | 128 ++++++++++++ frontend/src/components/Menu/Sidebar.vue | 43 +++-- .../MobileSidebar/MobileSidebar.vue | 16 +- 10 files changed, 910 insertions(+), 19 deletions(-) create mode 100644 frontend/public/img/svg/Community.svg create mode 100644 frontend/public/img/svg/home.svg create mode 100644 frontend/public/img/svg/info.svg create mode 100644 frontend/public/img/svg/lines.png create mode 100644 frontend/public/img/svg/logout.svg create mode 100644 frontend/public/img/svg/send.svg create mode 100644 frontend/public/img/svg/settings.svg create mode 100644 frontend/public/img/svg/transaction.svg diff --git a/frontend/public/img/svg/Community.svg b/frontend/public/img/svg/Community.svg new file mode 100644 index 000000000..8f1cdbd61 --- /dev/null +++ b/frontend/public/img/svg/Community.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/home.svg b/frontend/public/img/svg/home.svg new file mode 100644 index 000000000..9122b7e68 --- /dev/null +++ b/frontend/public/img/svg/home.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/info.svg b/frontend/public/img/svg/info.svg new file mode 100644 index 000000000..1d1b88c65 --- /dev/null +++ b/frontend/public/img/svg/info.svg @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/lines.png b/frontend/public/img/svg/lines.png new file mode 100644 index 0000000000000000000000000000000000000000..d7bf781b4be6ac5fab98f4c2af77a3886c6afbb3 GIT binary patch literal 793 zcmV+!1LpjRP)EX>4Tx04R}tkv&MmKpe$iQ$>-Ag9SwtGE^rEqEZ~S3Pq?8YK2xEOfLO`CJjl7 zi=*ILaPVWX>fqw6tAnc`2!4RLx;QDiNQwVT3N2zhIPS;0dyl(!fKV?p&FYu{G~G5+ ziMW`_u8Li+5HNr+Mi7&kWz0!Z629Z>9s$1IMR}J0xj#p*nzI-X5Q%4*VcNtS#Ia4= z;Ji;9W<^;gJ|`YG>4LCuqO|IySV+-++{ZuU`XzEHu~>4zgWm+@00006VoOIv0MG!C042tusF45w010qNS#tmY z3ljhU3ljkVnw%H_00AjUL_t(&-tCsXY63wNh0n~cD{jD_N=ajt7svyoNMkM7+1mID zg6JbyrxMZ$zK7T(l}PFk#6}PmT%8@Ot+J5aI0&YqyXj0>X%IlUW~M_jvH{1qQ7tCaeqq!3i6-No0cx+h5kYoTC{#OdJ$s z2$6XBxNsrhr3xPs4=KIRlLEQKdlHaB#Q$Tb@Iz~*n-B(J5QeGH^*MUdwr;-iJRH|w z+8tH~0N1aq*d|d9HK!;KVhf>@t zuT=doIx`r$=q7|g7=%F>*+`(Klcd#^VLC}#4a0Pj{P(5QUf+6IOOi~WbQ8iLj9cge XDP2hrBcs1j00000NkvXXu0mjfCt6%1 literal 0 HcmV?d00001 diff --git a/frontend/public/img/svg/logout.svg b/frontend/public/img/svg/logout.svg new file mode 100644 index 000000000..a9826a5dd --- /dev/null +++ b/frontend/public/img/svg/logout.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/send.svg b/frontend/public/img/svg/send.svg new file mode 100644 index 000000000..6f1d8dafa --- /dev/null +++ b/frontend/public/img/svg/send.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/settings.svg b/frontend/public/img/svg/settings.svg new file mode 100644 index 000000000..6966262f3 --- /dev/null +++ b/frontend/public/img/svg/settings.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/public/img/svg/transaction.svg b/frontend/public/img/svg/transaction.svg new file mode 100644 index 000000000..f7cb156ff --- /dev/null +++ b/frontend/public/img/svg/transaction.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 0875c0c7e..a6c0742e2 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -9,34 +9,34 @@
- + {{ $t('navigation.overview') }} - + {{ $t('navigation.send') }} - + {{ $t('navigation.transactions') }} + + + {{ $t('creation') }} + - {{ $t('gdt.gdt') }} + {{ $t('GDT') }} - - - {{ $t('creation') }} - - -
- - - + + {{ $t('navigation.info') }} + +
+ - + {{ $t('navigation.settings') }} {{ $t('navigation.admin_area') }} - + {{ $t('navigation.logout') }} @@ -74,10 +74,17 @@ export default { color: rgb(2, 2, 1); border-left: 4px rgb(219, 129, 19) solid; } +.svg-icon { + filter: brightness(1) invert(0); +} + +.activeRoute .svg-icon { + filter: brightness(0) invert(0); +} + #component-sidebar { min-width: 200px; } - @media screen and (min-width: 1025px) { #side-menu { max-width: 180px; @@ -86,7 +93,7 @@ export default { min-width: 180px; } } - +/* @media screen and (min-width: 1075px) { #side-menu { max-width: 200px; @@ -102,5 +109,5 @@ export default { #component-sidebar { max-width: 100%; } -} +} */ diff --git a/frontend/src/components/MobileSidebar/MobileSidebar.vue b/frontend/src/components/MobileSidebar/MobileSidebar.vue index dc59dc711..0f7a179a9 100644 --- a/frontend/src/components/MobileSidebar/MobileSidebar.vue +++ b/frontend/src/components/MobileSidebar/MobileSidebar.vue @@ -1,6 +1,14 @@