У меня есть поисковый запрос, который я использую php и postgres, теперь я хотел бы написать такой же запрос в nodejs, express и JWT с postgres
$query = db_select("emp_master", "r");
$query->fields("r", array("id","emp_id","published_date", "pay_sub_edate", "bid_opening_date", "emp_ref_no","pay_type","other_branch","panding"));
$query->condition('r.pay_sub_edate','now()','>');
$query->condition('r.published_date','now()','<');
$query->condition('r.content','Published','=');
$query->condition('r.published_date',$last_date,'<=');
$query->condition('r.pay_sub_edate',$last_date,'<=');
if($s_loc != 'null')
{
$query->where("location ILIKE '%".$s_loc."%'");
}
if($s_key != 'null')
{
$query->where("r.emp_id ILIKE '%".$s_key."%' or r.emp_ref_no ILIKE '%".$s_key."%' or r.pay_type ILIKE '%".$s_key."%' or r.tender_desc ILIKE '%".$s_key."%' or r.other_branch ILIKE '%".$s_key."%'");
}
if($s_org != 'select')
{
$query->condition("r.other_branch",$s_org,"=");
}
if($s_prod != 'select')
{
$query->condition('r.state_prod',$s_prod,'=');
}
$result = $query->execute();