mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Refactor to use filters in query listTransactionLinksAdmin
This commit is contained in:
parent
f901a76b2d
commit
85eaa4b391
@ -3,8 +3,8 @@ import { Field, InputType } from 'type-graphql'
|
||||
@InputType()
|
||||
export default class SearchUsersFilters {
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: null })
|
||||
byActivated?: boolean | null
|
||||
byActivated: boolean
|
||||
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: null })
|
||||
byDeleted?: boolean | null
|
||||
byDeleted: boolean
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
@InputType()
|
||||
export default class TransactionLinkFilters {
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: true })
|
||||
byDeleted?: boolean
|
||||
byDeleted: boolean
|
||||
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: true })
|
||||
byExpired?: boolean
|
||||
byExpired: boolean
|
||||
|
||||
@Field(() => Boolean, { nullable: true, defaultValue: true })
|
||||
byRedeemed?: boolean
|
||||
byRedeemed: boolean
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ export class AdminResolver {
|
||||
async listTransactionLinksAdmin(
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
@Args()
|
||||
@Arg('filters')
|
||||
filters: TransactionLinkFilters,
|
||||
@Arg('userId', () => Int) userId: number,
|
||||
): Promise<TransactionLinkResult> {
|
||||
|
||||
@ -163,3 +163,32 @@ export const deletePendingCreation = gql`
|
||||
deletePendingCreation(id: $id)
|
||||
}
|
||||
`
|
||||
|
||||
export const listTransactionLinksAdmin = gql`
|
||||
query (
|
||||
$userId: Int!
|
||||
$filters: TransactionLinkFilters!
|
||||
$currentPage: Int = 1
|
||||
$pageSize: Int = 5
|
||||
) {
|
||||
listTransactionLinksAdmin(
|
||||
userId: $userId
|
||||
filters: $filters
|
||||
currentPage: $currentPage
|
||||
pageSize: $pageSize
|
||||
) {
|
||||
linkCount
|
||||
linkList {
|
||||
id
|
||||
amount
|
||||
holdAvailableAmount
|
||||
memo
|
||||
code
|
||||
createdAt
|
||||
validUntil
|
||||
redeemedAt
|
||||
deletedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user