From b633c7006c16b11f65e31f19b9dbcb8999f0fe66 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 16 Aug 2021 17:36:10 +0200 Subject: [PATCH] try to get gdt transactionlist working --- backend/src/graphql/inputs/GdtInputs.ts | 5 +++-- backend/src/graphql/models/GdtEntry.ts | 1 + backend/src/graphql/resolvers/GdtResolver.ts | 10 +++++----- frontend/src/graphql/queries.js | 4 ++-- .../views/Pages/AccountOverview/GdtTransactionList.vue | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/backend/src/graphql/inputs/GdtInputs.ts b/backend/src/graphql/inputs/GdtInputs.ts index 0400c3278..1404fbf14 100644 --- a/backend/src/graphql/inputs/GdtInputs.ts +++ b/backend/src/graphql/inputs/GdtInputs.ts @@ -14,15 +14,16 @@ export class GdtTransactionInput { @Field(() => String, { nullable: true }) order?: string } + @ArgsType() export class GdtTransactionSessionIdInput { @Field(() => Number) sessionId: number - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) currentPage?: number - @Field(() => Number, { nullable: true }) + @Field(() => Int, { nullable: true }) pageSize?: number @Field(() => String, { nullable: true }) diff --git a/backend/src/graphql/models/GdtEntry.ts b/backend/src/graphql/models/GdtEntry.ts index 014195fcd..48ca91160 100644 --- a/backend/src/graphql/models/GdtEntry.ts +++ b/backend/src/graphql/models/GdtEntry.ts @@ -15,6 +15,7 @@ export enum GdtEntryType { @ObjectType() export class GdtEntry { constructor(json: any) { + // console.log(json) this.transactionId = json.transaction_id this.amount = json.amount this.date = json.date diff --git a/backend/src/graphql/resolvers/GdtResolver.ts b/backend/src/graphql/resolvers/GdtResolver.ts index 13e3b7258..f253e70a0 100644 --- a/backend/src/graphql/resolvers/GdtResolver.ts +++ b/backend/src/graphql/resolvers/GdtResolver.ts @@ -2,7 +2,7 @@ import { Resolver, Query, /* Mutation, */ Args } from 'type-graphql' import CONFIG from '../../config' import { GdtEntryList } from '../models/GdtEntryList' -import { GdtTransactionInput } from '../inputs/GdtInputs' +import { GdtTransactionSessionIdInput } from '../inputs/GdtInputs' import { apiGet } from '../../apis/loginAPI' @Resolver() @@ -10,13 +10,13 @@ export class GdtResolver { @Query(() => GdtEntryList) // eslint-disable-next-line @typescript-eslint/no-explicit-any async listGDTEntries( - @Args() { email, currentPage = 1, pageSize = 5, order = 'DESC' }: GdtTransactionInput, + @Args() + { currentPage = 1, pageSize = 5, order = 'DESC', sessionId }: GdtTransactionSessionIdInput, ): Promise { - email = email.trim().toLowerCase() const result = await apiGet( - `${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${email}/${currentPage}/${pageSize}/${order}`, + `${CONFIG.GDT_API_URL}/listGDTTransactions/${currentPage}/${pageSize}/${order}/${sessionId}`, ) - + // console.log(result.data) if (!result.success) { throw new Error(result.data) } diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 81f44ddda..efcdefae2 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -125,8 +125,8 @@ export const checkUsername = gql` ` export const listGDTEntriesQuery = gql` - query($email: String!, $currentPage: Int!, $pageSize: Int!) { - listGDTEntries(email: $email, currentPage: $currentPage, pageSize: $pageSize) { + query($currentPage: Int!, $pageSize: Int!, $sessionId: Float!) { + listGDTEntries(currentPage: $currentPage, pageSize: $pageSize, sessionId: $sessionId) { count gdtEntries { transactionId diff --git a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue index 958b2c2d9..8193717cf 100644 --- a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue +++ b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue @@ -199,7 +199,7 @@ export default { .query({ query: listGDTEntriesQuery, variables: { - email: this.$store.state.email, + sessionId: this.$store.state.sessionId, currentPage: this.currentPage, pageSize: this.pageSize, },