@@ -22,8 +22,8 @@ defmodule Algora.Jobs do
2222 JobPosting
2323 |> maybe_filter_by_ids ( opts [ :ids ] )
2424 |> maybe_filter_by_status ( opts )
25- |> maybe_filter_by_user ( opts )
2625 |> join ( :inner , [ j ] , u in User , on: u . id == j . user_id )
26+ |> maybe_filter_by_user ( opts )
2727 |> maybe_filter_by_handle ( opts [ :handle ] )
2828 |> maybe_filter_by_tech_stack ( opts [ :tech_stack ] )
2929 |> join ( :left , [ j ] , i in JobInterview , on: i . job_posting_id == j . id and i . status not in [ :initial ] )
@@ -83,6 +83,9 @@ defmodule Algora.Jobs do
8383 opts [ :user_id ] ->
8484 where ( query , [ j ] , j . user_id == ^ opts [ :user_id ] and j . status in [ :active , :processing ] )
8585
86+ opts [ :handles ] && opts [ :handles ] != [ ] ->
87+ where ( query , [ j , u ] , u . handle in ^ opts [ :handles ] and j . status in [ :active , :processing ] )
88+
8689 is_nil ( opts [ :user_id ] ) and is_nil ( opts [ :handles ] ) and is_nil ( opts [ :handle ] ) ->
8790 where ( query , [ j , u ] , j . status in [ :active ] )
8891
@@ -107,6 +110,7 @@ defmodule Algora.Jobs do
107110 cond do
108111 opts [ :status ] == :all -> where ( query , [ j ] , j . status in [ :active , :processing ] )
109112 opts [ :user_id ] -> where ( query , [ j ] , j . status in [ :active , :processing ] )
113+ opts [ :handles ] && opts [ :handles ] != [ ] -> where ( query , [ j , u ] , j . status in [ :active , :processing ] )
110114 opts [ :handle ] -> where ( query , [ j , u ] , j . status in [ :active , :processing ] )
111115 opts [ :ids ] -> where ( query , [ j , u ] , j . status in [ :active , :processing ] )
112116 true -> where ( query , [ j ] , j . status in [ :active ] )
0 commit comments