Skip to content

Commit 88a9b52

Browse files
committed
Implement engagement date filters with override matching
1 parent cd14661 commit 88a9b52

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/components/engagement/engagement.repository.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,40 @@ export const engagementFilters = filter.define(() => EngagementFilters, {
619619
node('node', 'User'),
620620
]),
621621
),
622-
startDate: filter.dateTimeProp(),
623-
endDate: filter.dateTimeProp(),
622+
startDate: filter.dateTime(({ query }) => {
623+
query.optionalMatch([
624+
[
625+
node('node'),
626+
relation('out', '', 'startDateOverride', ACTIVE),
627+
node('startDateOverride', 'Property'),
628+
],
629+
[
630+
node('node'),
631+
relation('in', '', 'engagement'),
632+
node('project', 'Project'),
633+
relation('out', '', 'mouStart', ACTIVE),
634+
node('mouStart', 'Property'),
635+
],
636+
]);
637+
return coalesce('startDateOverride.value', 'mouStart.value');
638+
}),
639+
endDate: filter.dateTime(({ query }) => {
640+
query.optionalMatch([
641+
[
642+
node('node'),
643+
relation('out', '', 'endDateOverride', ACTIVE),
644+
node('endDateOverride', 'Property'),
645+
],
646+
[
647+
node('node'),
648+
relation('in', '', 'engagement'),
649+
node('project', 'Project'),
650+
relation('out', '', 'mouEnd', ACTIVE),
651+
node('mouEnd', 'Property'),
652+
],
653+
]);
654+
return coalesce('endDateOverride.value', 'mouEnd.value');
655+
}),
624656
});
625657

626658
export const engagementSorters = defineSorters(IEngagement, {

0 commit comments

Comments
 (0)