diff --git a/backend/src/graphql/arg/TransactionLinkFilters.ts b/backend/src/graphql/arg/TransactionLinkFilters.ts index a335f6a28..291d244c3 100644 --- a/backend/src/graphql/arg/TransactionLinkFilters.ts +++ b/backend/src/graphql/arg/TransactionLinkFilters.ts @@ -2,12 +2,12 @@ import { Field, InputType } from 'type-graphql' @InputType() export default class TransactionLinkFilters { - @Field(() => Boolean, { nullable: true, defaultValue: true }) + @Field(() => Boolean, { nullable: true }) withDeleted: boolean - @Field(() => Boolean, { nullable: true, defaultValue: true }) + @Field(() => Boolean, { nullable: true }) withExpired: boolean - @Field(() => Boolean, { nullable: true, defaultValue: true }) + @Field(() => Boolean, { nullable: true }) withRedeemed: boolean } diff --git a/backend/src/graphql/resolver/AdminResolver.test.ts b/backend/src/graphql/resolver/AdminResolver.test.ts index a755b0da6..eee013e84 100644 --- a/backend/src/graphql/resolver/AdminResolver.test.ts +++ b/backend/src/graphql/resolver/AdminResolver.test.ts @@ -21,9 +21,8 @@ import { updatePendingCreation, deletePendingCreation, confirmPendingCreation, - listTransactionLinksAdmin, } from '@/seeds/graphql/mutations' -import { getPendingCreations, login } from '@/seeds/graphql/queries' +import { getPendingCreations, login, listTransactionLinksAdmin } from '@/seeds/graphql/queries' import { GraphQLError } from 'graphql' import { User } from '@entity/User' /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ @@ -1388,6 +1387,7 @@ describe('AdminResolver', () => { user = await userFactory(testEnv, bibiBloxberg) variables.userId = user.id + variables.pageSize = 25 // bibi needs GDDs const bibisCreation = creations.find((creation) => creation.email === 'bibi@bloxberg.de') // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -1486,8 +1486,6 @@ describe('AdminResolver', () => { ...variables, filters: { withDeleted: true, - withExpired: null, - withRedeemed: null, }, }, }), @@ -1513,8 +1511,7 @@ describe('AdminResolver', () => { }) }) - // TODO: works not as expected, because the expired link is not in the result eventhogh a link has 'createdAt' at the very first of 2022 and should be expired - describe.skip('filter by expired', () => { + describe('filter by expired', () => { it('finds 6 open transaction links and 1 deleted and no redeemed', async () => { await expect( query({ @@ -1522,9 +1519,7 @@ describe('AdminResolver', () => { variables: { ...variables, filters: { - withDeleted: null, withExpired: true, - withRedeemed: null, }, }, }), diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 8e2d21893..4c94e48c8 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -426,7 +426,7 @@ export class AdminResolver { async listTransactionLinksAdmin( @Args() { currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated, - @Arg('filters', () => TransactionLinkFilters, { nullable: true, defaultValue: null }) + @Arg('filters', () => TransactionLinkFilters, { nullable: true }) filters: TransactionLinkFilters, @Arg('userId', () => Int) userId: number,