|
8 | 8 | Query,
|
9 | 9 | relation,
|
10 | 10 | } from 'cypher-query-builder';
|
11 |
| -import { difference, pickBy } from 'lodash'; |
| 11 | +import { difference, pickBy, upperFirst } from 'lodash'; |
12 | 12 | import { DateTime } from 'luxon';
|
13 | 13 | import { MergeExclusive } from 'type-fest';
|
14 | 14 | import {
|
@@ -609,6 +609,26 @@ export const engagementSorters = defineSorters(IEngagement, {
|
609 | 609 | .match([node('project'), relation('out', '', 'engagement'), node('node')])
|
610 | 610 | .apply(matchProjectSens())
|
611 | 611 | .return<{ sortValue: unknown }>('sensitivity as sortValue'),
|
| 612 | + ...mapValues.fromList( |
| 613 | + ['startDate', 'endDate'], |
| 614 | + (field) => (query: Query) => |
| 615 | + query |
| 616 | + .optionalMatch([ |
| 617 | + node('node'), |
| 618 | + relation('out', '', `${field}Override`, ACTIVE), |
| 619 | + node('override', 'Property'), |
| 620 | + ]) |
| 621 | + .optionalMatch([ |
| 622 | + node('node'), |
| 623 | + relation('in', '', 'engagement'), |
| 624 | + node('project'), |
| 625 | + relation('out', '', `mou${upperFirst(field.slice(0, -4))}`, ACTIVE), |
| 626 | + node('projProp'), |
| 627 | + ]) |
| 628 | + .return<{ sortValue: unknown }>( |
| 629 | + coalesce('override.value', 'projProp.value').as('sortValue'), |
| 630 | + ), |
| 631 | + ).asRecord, |
612 | 632 | // eslint-disable-next-line @typescript-eslint/naming-convention
|
613 | 633 | 'language.*': (query, input) =>
|
614 | 634 | query
|
|
0 commit comments