Gdt List without session ID

This commit is contained in:
Moriz Wahl 2021-08-30 17:47:59 +02:00
parent ce2826388e
commit 02a70c5acf
5 changed files with 10 additions and 16 deletions

View File

@ -17,9 +17,6 @@ export class GdtTransactionInput {
@ArgsType()
export class GdtTransactionSessionIdInput {
@Field(() => Number)
sessionId: number
@Field(() => Int, { nullable: true })
currentPage?: number

View File

@ -1,5 +1,7 @@
// import jwt from 'jsonwebtoken'
import { Resolver, Query, /* Mutation, */ Args } from 'type-graphql'
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { Resolver, Query, Args, Ctx, Authorized } from 'type-graphql'
import CONFIG from '../../config'
import { GdtEntryList } from '../models/GdtEntryList'
import { GdtTransactionSessionIdInput } from '../inputs/GdtInputs'
@ -7,14 +9,16 @@ import { apiGet } from '../../apis/loginAPI'
@Resolver()
export class GdtResolver {
@Authorized()
@Query(() => GdtEntryList)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async listGDTEntries(
@Args()
{ currentPage = 1, pageSize = 5, order = 'DESC', sessionId }: GdtTransactionSessionIdInput,
{ currentPage = 1, pageSize = 5, order = 'DESC' }: GdtTransactionSessionIdInput,
@Ctx() context: any,
): Promise<GdtEntryList> {
const result = await apiGet(
`${CONFIG.COMMUNITY_API_URL}listGDTTransactions/${currentPage}/${pageSize}/${order}/${sessionId}`,
`${CONFIG.COMMUNITY_API_URL}listGDTTransactions/${currentPage}/${pageSize}/${order}/${context.sessionId}`,
)
if (!result.success) {
throw new Error(result.data)

View File

@ -113,8 +113,8 @@ export const checkUsername = gql`
`
export const listGDTEntriesQuery = gql`
query($currentPage: Int!, $pageSize: Int!, $sessionId: Float!) {
listGDTEntries(currentPage: $currentPage, pageSize: $pageSize, sessionId: $sessionId) {
query($currentPage: Int!, $pageSize: Int!) {
listGDTEntries(currentPage: $currentPage, pageSize: $pageSize) {
count
gdtEntries {
amount

View File

@ -57,11 +57,6 @@ describe('GdtTransactionList', () => {
$t: jest.fn((t) => t),
$n: jest.fn((n) => n),
$d: jest.fn((d) => d),
$store: {
state: {
sessionId: 1,
},
},
$toasted: {
error: toastErrorMock,
},
@ -89,7 +84,6 @@ describe('GdtTransactionList', () => {
expect(apolloMock).toBeCalledWith(
expect.objectContaining({
variables: {
sessionId: 1,
currentPage: 1,
pageSize: 25,
},

View File

@ -199,7 +199,6 @@ export default {
.query({
query: listGDTEntriesQuery,
variables: {
sessionId: this.$store.state.sessionId,
currentPage: this.currentPage,
pageSize: this.pageSize,
},