File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/components/project/handlers Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,16 @@ export class SetDepartmentId implements IEventHandler<SubscribedEvent> {
105
105
. where ( { 'deptIdNode.value' : not ( isNull ( ) ) } )
106
106
. return ( collect ( 'deptIdNode.value' ) . as ( 'used' ) ) ,
107
107
)
108
- // Distill to available
109
- . with ( '[id in enumerated where not id in used][0] as next' )
108
+ // Get blacklisted IDs
109
+ . subQuery ( ( sub ) =>
110
+ sub
111
+ . match ( node ( 'blacklist' , 'BlacklistDepartmentId' ) )
112
+ . return ( collect ( 'blacklist.departmentId' ) . as ( 'blacklisted' ) ) ,
113
+ )
114
+ // Distill to available (excluding both used AND blacklisted)
115
+ . with (
116
+ '[id in enumerated where not id in used and not id in blacklisted][0] as next' ,
117
+ )
110
118
// collapse cardinality to zero if none available
111
119
. raw ( 'unwind next as nextId' )
112
120
You can’t perform that action at this time.
0 commit comments