what the fuck

This commit is contained in:
Moriz Wahl 2023-03-10 15:03:46 +01:00
parent d9b19fbfa0
commit 66bfd6c884

View File

@ -7,10 +7,10 @@ interface FindContributionsOptions {
order: Order order: Order
currentPage: number currentPage: number
pageSize: number pageSize: number
withDeleted?: boolean withDeleted?: boolean | null
relations?: string[] relations?: string[] | null
userId?: number userId?: number | null
statusFilter?: ContributionStatus[] statusFilter?: ContributionStatus[] | null
} }
export const findContributions = async ( export const findContributions = async (
@ -18,6 +18,7 @@ export const findContributions = async (
): Promise<[DbContribution[], number]> => { ): Promise<[DbContribution[], number]> => {
const { order, currentPage, pageSize, withDeleted, relations, userId, statusFilter } = { const { order, currentPage, pageSize, withDeleted, relations, userId, statusFilter } = {
withDeleted: false, withDeleted: false,
relations: [],
...options, ...options,
} }
return DbContribution.findAndCount({ return DbContribution.findAndCount({
@ -25,7 +26,7 @@ export const findContributions = async (
...(statusFilter && statusFilter.length && { contributionStatus: In(statusFilter) }), ...(statusFilter && statusFilter.length && { contributionStatus: In(statusFilter) }),
...(userId && { userId }), ...(userId && { userId }),
}, },
withDeleted: withDeleted, withDeleted,
order: { order: {
createdAt: order, createdAt: order,
id: order, id: order,