mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
try to get gdt transactionlist working
This commit is contained in:
parent
594030eb9a
commit
b633c7006c
@ -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 })
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user