@@ -17,6 +17,7 @@ import {
17
17
createNode ,
18
18
createRelationships ,
19
19
defineSorters ,
20
+ filter ,
20
21
filter as filters ,
21
22
matchProjectScopedRoles ,
22
23
matchProjectSens ,
@@ -28,6 +29,10 @@ import {
28
29
requestingUser ,
29
30
sortWith ,
30
31
} from '~/core/database/query' ;
32
+ import {
33
+ organizationFilters ,
34
+ organizationSorters ,
35
+ } from '../organization/organization.repository' ;
31
36
import {
32
37
CreatePartner ,
33
38
Partner ,
@@ -305,6 +310,15 @@ export const partnerFilters = filters.define(() => PartnerFilters, {
305
310
relation ( 'in' , '' , 'organization' , ACTIVE ) ,
306
311
node ( '' , 'User' , { id } ) ,
307
312
] ) ,
313
+ organization : filter . sub ( ( ) => organizationFilters ) ( ( sub ) =>
314
+ sub
315
+ . with ( 'node as partner' )
316
+ . match ( [
317
+ node ( 'partner' ) ,
318
+ relation ( 'out' , '' , 'organization' ) ,
319
+ node ( 'node' , 'Organization' ) ,
320
+ ] ) ,
321
+ ) ,
308
322
} ) ;
309
323
310
324
export const partnerSorters = defineSorters ( Partner , {
@@ -318,4 +332,14 @@ export const partnerSorters = defineSorters(Partner, {
318
332
node ( 'prop' , 'Property' ) ,
319
333
] )
320
334
. return < { sortValue : string } > ( 'prop.value as sortValue' ) ,
335
+ // eslint-disable-next-line @typescript-eslint/naming-convention
336
+ 'organization.*' : ( query , input ) =>
337
+ query
338
+ . with ( 'node as partner' )
339
+ . match ( [
340
+ node ( 'partner' ) ,
341
+ relation ( 'out' , '' , 'organization' ) ,
342
+ node ( 'node' , 'Organization' ) ,
343
+ ] )
344
+ . apply ( sortWith ( organizationSorters , input ) ) ,
321
345
} ) ;
0 commit comments