Added vehicle search function + paginated vehicles page BOD-116

This commit is contained in:
Patrick Fic
2020-07-13 15:50:07 -07:00
parent 934dc1f647
commit d5026133e0
12 changed files with 215 additions and 28 deletions

View File

@@ -0,0 +1 @@
[]

View File

@@ -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

View File

@@ -0,0 +1 @@
[]

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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