mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Gdt List without session ID
This commit is contained in:
parent
ce2826388e
commit
02a70c5acf
@ -17,9 +17,6 @@ export class GdtTransactionInput {
|
||||
|
||||
@ArgsType()
|
||||
export class GdtTransactionSessionIdInput {
|
||||
@Field(() => Number)
|
||||
sessionId: number
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
currentPage?: number
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
},
|
||||
|
||||
@ -199,7 +199,6 @@ export default {
|
||||
.query({
|
||||
query: listGDTEntriesQuery,
|
||||
variables: {
|
||||
sessionId: this.$store.state.sessionId,
|
||||
currentPage: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user