mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
Merge branch 'master' into remove_email_sender
This commit is contained in:
commit
671c527b14
@ -6,15 +6,15 @@ import { Order } from '@enum/Order'
|
||||
|
||||
@ArgsType()
|
||||
export class Paginated {
|
||||
@Field(() => Int, { defaultValue: 1 })
|
||||
@Field(() => Int, { nullable: true })
|
||||
@IsPositive()
|
||||
currentPage: number
|
||||
currentPage?: number
|
||||
|
||||
@Field(() => Int, { defaultValue: 3 })
|
||||
@Field(() => Int, { nullable: true })
|
||||
@IsPositive()
|
||||
pageSize: number
|
||||
pageSize?: number
|
||||
|
||||
@Field(() => Order, { defaultValue: Order.DESC })
|
||||
@Field(() => Order, { nullable: true })
|
||||
@IsEnum(Order)
|
||||
order: Order
|
||||
order?: Order
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import { Paginated } from '@arg/Paginated'
|
||||
import { SearchContributionsFilterArgs } from '@arg/SearchContributionsFilterArgs'
|
||||
import { Connection } from '@typeorm/connection'
|
||||
|
||||
import { Order } from '@/graphql/enum/Order'
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
interface Relations {
|
||||
@ -28,7 +29,7 @@ function joinRelationsRecursive(
|
||||
}
|
||||
|
||||
export const findContributions = async (
|
||||
paginate: Paginated,
|
||||
{ pageSize = 3, currentPage = 1, order = Order.DESC }: Paginated,
|
||||
filter: SearchContributionsFilterArgs,
|
||||
withDeleted = false,
|
||||
relations: Relations | undefined = undefined,
|
||||
@ -61,9 +62,9 @@ export const findContributions = async (
|
||||
)
|
||||
}
|
||||
return queryBuilder
|
||||
.orderBy('Contribution.createdAt', paginate.order)
|
||||
.addOrderBy('Contribution.id', paginate.order)
|
||||
.skip((paginate.currentPage - 1) * paginate.pageSize)
|
||||
.take(paginate.pageSize)
|
||||
.orderBy('Contribution.createdAt', order)
|
||||
.addOrderBy('Contribution.id', order)
|
||||
.skip((currentPage - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user