try to get gdt transactionlist working

This commit is contained in:
Moriz Wahl 2021-08-16 17:36:10 +02:00
parent 594030eb9a
commit b633c7006c
5 changed files with 12 additions and 10 deletions

View File

@ -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 })

View File

@ -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

View File

@ -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<GdtEntryList> {
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)
}

View File

@ -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

View File

@ -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,
},