Work on CRUD v2 and better SQL WHERE part building... I hope.
This commit is contained in:
@@ -298,6 +298,9 @@ def handle_get_obj_li(
|
||||
|
||||
import urllib
|
||||
|
||||
# This should be a list of SQL WHERE parts defined in JSON.
|
||||
qry_dict_li = None
|
||||
|
||||
# This should be a dict list of fields with a list of values to search for using FULLTEXT.
|
||||
fulltext_qry_dict_obj = None
|
||||
|
||||
@@ -325,6 +328,32 @@ def handle_get_obj_li(
|
||||
|
||||
log.info(jp_obj)
|
||||
|
||||
if jp_obj.get('qry'): # NOTE: This is for specific additional WHERE clauses in the SQL statement
|
||||
# Example JSON:
|
||||
# jp: {
|
||||
# qry: [
|
||||
# {
|
||||
# type: "AND",
|
||||
# field: "enable",
|
||||
# operator: "=",
|
||||
# value: TRUE
|
||||
# },
|
||||
# {
|
||||
# type: "AND",
|
||||
# field: "example",
|
||||
# operator: ">=",
|
||||
# value: 2
|
||||
# },
|
||||
# {
|
||||
# type: "OR",
|
||||
# field: "test",
|
||||
# operator: "LIKE",
|
||||
# value: "%xyz%"
|
||||
# },
|
||||
# ]
|
||||
# }
|
||||
qry_dict_li = jp_obj['qry']
|
||||
|
||||
if jp_obj.get('ft_qry'): # NOTE: This is for the fulltext query
|
||||
fulltext_qry_dict_obj = jp_obj['ft_qry']
|
||||
|
||||
@@ -445,6 +474,7 @@ def handle_get_obj_li(
|
||||
field_value = for_obj_id,
|
||||
enabled = commons.enabled,
|
||||
hidden = hidden,
|
||||
qry_dict_li = qry_dict_li,
|
||||
fulltext_qry_dict = fulltext_qry_dict_obj,
|
||||
and_qry_dict = and_qry_dict_obj,
|
||||
and_like_dict = and_like_dict_obj,
|
||||
@@ -465,6 +495,7 @@ def handle_get_obj_li(
|
||||
table_name = table_name,
|
||||
enabled = commons.enabled,
|
||||
hidden = hidden,
|
||||
qry_dict_li = qry_dict_li,
|
||||
fulltext_qry_dict = fulltext_qry_dict_obj,
|
||||
and_qry_dict = and_qry_dict_obj,
|
||||
and_like_dict = and_like_dict_obj,
|
||||
|
||||
Reference in New Issue
Block a user