Skip to content

Commit

Permalink
feat: small fix for the Ongoing OR condition (#2777)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-shvadron committed Oct 14, 2024
1 parent 47688f2 commit 7a605fd
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,23 @@ export class BusinessReportControllerInternal {
@CurrentProject() currentProjectId: TProjectId,
@Query() { businessId, batchId, page, search, type, orderBy }: ListBusinessReportsDto,
) {
const ongoingOrCondition = [
{
type: {
not: {
equals: BusinessReportType.ONGOING_MERCHANT_REPORT_T1,
},
},
},
{
type: BusinessReportType.ONGOING_MERCHANT_REPORT_T1,
status: BusinessReportStatus.completed,
},
];
const args = {
where: {
businessId,
batchId,
OR: [
{
type: {
not: {
equals: BusinessReportType.ONGOING_MERCHANT_REPORT_T1,
},
},
},
{
type: BusinessReportType.ONGOING_MERCHANT_REPORT_T1,
status: BusinessReportStatus.completed,
},
],
...(type ? { type } : {}),
...(search
? {
Expand All @@ -263,9 +263,10 @@ export class BusinessReportControllerInternal {
},
},
{ business: { website: { contains: search, mode: QueryMode.Insensitive } } },
...ongoingOrCondition,
],
}
: {}),
: { OR: ongoingOrCondition }),
},
select: {
id: true,
Expand Down

0 comments on commit 7a605fd

Please sign in to comment.