Added vehicle search function + paginated vehicles page BOD-116
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,7 @@
|
||||
- args:
|
||||
cascade: true
|
||||
read_only: false
|
||||
sql: |-
|
||||
CREATE INDEX idx_vehicles_vin ON vehicles USING GIN (v_vin gin_trgm_ops);
|
||||
CREATE INDEX idx_vehicles_plateno ON vehicles USING GIN (plate_no gin_trgm_ops);
|
||||
type: run_sql
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
13
hasura/migrations/1594680221027_run_sql_migration/up.yaml
Normal file
13
hasura/migrations/1594680221027_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
- args:
|
||||
cascade: true
|
||||
read_only: false
|
||||
sql: "CREATE OR REPLACE FUNCTION public.search_vehicles(search text)\n RETURNS
|
||||
SETOF vehicles\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if search
|
||||
= '' then\n return query select * from vehicles ;\n else \n return query
|
||||
SELECT\n *\nFROM\n vehicles\nWHERE\n search <% (v_vin) OR\n search <% (plate_no);\n
|
||||
\ end if;\n\n\tEND\n$function$;"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: search_vehicles
|
||||
schema: public
|
||||
type: track_function
|
||||
@@ -0,0 +1,50 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: vehicles
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- v_paint_codes
|
||||
- db_v_code
|
||||
- plate_no
|
||||
- plate_st
|
||||
- trim_color
|
||||
- v_bstyle
|
||||
- v_color
|
||||
- v_cond
|
||||
- v_engine
|
||||
- v_makecode
|
||||
- v_make_desc
|
||||
- v_mldgcode
|
||||
- v_model_desc
|
||||
- v_model_yr
|
||||
- v_options
|
||||
- v_prod_dt
|
||||
- v_stage
|
||||
- v_tone
|
||||
- v_trimcode
|
||||
- v_type
|
||||
- v_vin
|
||||
- created_at
|
||||
- updated_at
|
||||
- id
|
||||
- shopid
|
||||
computed_fields: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: vehicles
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,50 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: vehicles
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: true
|
||||
columns:
|
||||
- v_paint_codes
|
||||
- db_v_code
|
||||
- plate_no
|
||||
- plate_st
|
||||
- trim_color
|
||||
- v_bstyle
|
||||
- v_color
|
||||
- v_cond
|
||||
- v_engine
|
||||
- v_makecode
|
||||
- v_make_desc
|
||||
- v_mldgcode
|
||||
- v_model_desc
|
||||
- v_model_yr
|
||||
- v_options
|
||||
- v_prod_dt
|
||||
- v_stage
|
||||
- v_tone
|
||||
- v_trimcode
|
||||
- v_type
|
||||
- v_vin
|
||||
- created_at
|
||||
- updated_at
|
||||
- id
|
||||
- shopid
|
||||
computed_fields: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: vehicles
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -3790,6 +3790,7 @@ tables:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
allow_aggregations: true
|
||||
update_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
@@ -3985,3 +3986,6 @@ functions:
|
||||
- function:
|
||||
schema: public
|
||||
name: search_payments
|
||||
- function:
|
||||
schema: public
|
||||
name: search_vehicles
|
||||
|
||||
Reference in New Issue
Block a user