47JKAGWEDSPFXKMFOVMTEYGUFFS5SEJMNZIZPJJAWJ5U3CH5YGMQC
NAAQ2HMF7NXGJDRPXATVAGGZWL5MAIQWF4K5S23VFYBPOPZUXJZAC
R3NNNQ3C6ITL5FMPMEUNRXQIZX2K2LBHWB762N6TBYQVZQAUFR5QC
E4HFJ4L4PAGV7R7EXVG2B2CWDGGW7XWU4D37VURZ66HZ3ILHCFUAC
63VXWIHIAKGK7J4VTNRUAG2V32N2QUSWFELB6GD34S54FGRWAPCQC
PEVQ4WY77RA6HMHM2C4HLJ5YKRLHYCAD7MDIWD6POZTJZMMMBVGAC
WYTMZJFYVKHR4QH7AV5JUNWXT6NAC5NNQNPZCQSDI6LGI7DVXFYAC
X4XDT5S7ISHUZAJ4TK2FBEV55NY6CCUVZL2LN7DTBQ7AJCP5P3QAC
_in_stock boolean = null
in_stock boolean = null,
sort_price boolean = null,--true asc, false desc, null don't sort by it
sort_thc boolean = null,--not working yet
sort_cbd boolean = null,--not working yet
sort_rank boolean = null,--contingent on ranking
search text = null
(type = _type or _type is null)
--brand ilike $1
--order by cbd, thc, min_price, etc. idk if ranges are sortable... looks like they are
(type = _type or _type is null) and
(species = _species or _species is null)
order by
word_similarity(concat_ws(' ', producer, brand, product.display_name), lower(search)),
case when sort_price then min end asc,
case when not sort_price then min end desc
case 'productsq':
const [strains, pgenum] = await Promise.all([
pool.query('select strain_id as id, display_name as name from strain').then(x => x.rows),
pool.query(`select
array_to_json(enum_range(null::species)) as species,
array_to_json(enum_range(null::product_type)) as product_types,
array_to_json(enum_range(null::effect)) as effects,
array_to_json(enum_range(null::comt)) as comt,
array_to_json(enum_range(null::akt1)) as akt1,
array_to_json(enum_range(null::cyp2c9)) as cyp2c9,
array_to_json(enum_range(null::cyp2c19_2)) as cyp2c19_2,
array_to_json(enum_range(null::cyp2c19_3)) as cyp2c19_3,
array_to_json(enum_range(null::cyp2c19_17)) as cyp2c19_17
`).then(x => x.rows[0])
]);
ws.send(JSON.stringify({
response_ID: request_ID,
data: {strains, ...pgenum}
}));
break;
qs += `_in_stock => $${params.push(parameters.in_stock)},`;
qs += `in_stock => $${params.push(parameters.in_stock)},`;
}
if(typeof parameters.sort_price === 'boolean') {
qs += `sort_price => $${params.push(parameters.sort_price)},`;