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 authored Oct 14, 2024
1 parent 58a3373 commit 04bd1c6
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 04bd1c6

Please sign in to comment.