Database auth is fully fixed and functional except for outbound firebase.

This commit is contained in:
Patrick Fic
2019-12-06 12:05:33 -08:00
parent ab1e4d5424
commit 78c43fa1e5
58 changed files with 8435 additions and 140 deletions

View File

@@ -1,11 +0,0 @@
- args:
sql: CREATE TABLE "public"."associations"("shopid" uuid NOT NULL, "useremail"
text NOT NULL, "active" boolean NOT NULL DEFAULT false, PRIMARY KEY ("shopid","useremail")
, FOREIGN KEY ("shopid") REFERENCES "public"."bodyshops"("shopid") ON UPDATE
restrict ON DELETE restrict, FOREIGN KEY ("useremail") REFERENCES "public"."users"("email")
ON UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: associations
schema: public
type: add_existing_table_or_view

View File

@@ -1,13 +0,0 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: CREATE TABLE "public"."jobs"("jobid" uuid NOT NULL DEFAULT gen_random_uuid(),
"ro_number" text NOT NULL, "est_number" text NOT NULL, "shopid" uuid NOT NULL,
PRIMARY KEY ("jobid") , FOREIGN KEY ("shopid") REFERENCES "public"."bodyshops"("shopid")
ON UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: jobs
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,3 @@
- args:
sql: DROP TABLE "public"."navitems"
type: run_sql

View File

@@ -0,0 +1,8 @@
- args:
sql: CREATE TABLE "public"."navitems"("key" text NOT NULL, "value" text NOT NULL,
PRIMARY KEY ("key") );
type: run_sql
- args:
name: navitems
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,3 @@
- args:
sql: DROP TABLE "public"."navitems"
type: run_sql

View File

@@ -1,5 +1,5 @@
- args:
sql: CREATE TABLE "public"."masterdata"("key" text NOT NULL, "value" jsonb NOT
sql: CREATE TABLE "public"."masterdata"("key" text NOT NULL, "value" text NOT
NULL, PRIMARY KEY ("key") );
type: run_sql
- args:

View File

@@ -0,0 +1,6 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,11 @@
- args:
permission:
allow_aggregations: false
columns: []
filter: {}
limit: null
role: anonymous
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -2,8 +2,8 @@
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: CREATE TABLE "public"."bodyshops"("shopid" uuid NOT NULL DEFAULT gen_random_uuid(),
"name" text NOT NULL, PRIMARY KEY ("shopid") );
sql: CREATE TABLE "public"."bodyshops"("id" uuid NOT NULL DEFAULT gen_random_uuid(),
"shopname" text NOT NULL, PRIMARY KEY ("id") );
type: run_sql
- args:
name: bodyshops

View File

@@ -0,0 +1,14 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: CREATE TABLE "public"."associations"("id" uuid NOT NULL DEFAULT gen_random_uuid(),
"shopid" uuid NOT NULL, "useremail" text NOT NULL, PRIMARY KEY ("id") , FOREIGN
KEY ("shopid") REFERENCES "public"."bodyshops"("id") ON UPDATE restrict ON DELETE
restrict, FOREIGN KEY ("useremail") REFERENCES "public"."users"("email") ON
UPDATE restrict ON DELETE restrict);
type: run_sql
- args:
name: associations
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,24 @@
- args:
relationship: user
table:
name: associations
schema: public
type: drop_relationship
- args:
relationship: bodyshop
table:
name: associations
schema: public
type: drop_relationship
- args:
relationship: associations
table:
name: bodyshops
schema: public
type: drop_relationship
- args:
relationship: associations
table:
name: users
schema: public
type: drop_relationship

View File

@@ -0,0 +1,40 @@
- args:
name: user
table:
name: associations
schema: public
using:
foreign_key_constraint_on: useremail
type: create_object_relationship
- args:
name: bodyshop
table:
name: associations
schema: public
using:
foreign_key_constraint_on: shopid
type: create_object_relationship
- args:
name: associations
table:
name: bodyshops
schema: public
using:
foreign_key_constraint_on:
column: shopid
table:
name: associations
schema: public
type: create_array_relationship
- args:
name: associations
table:
name: users
schema: public
using:
foreign_key_constraint_on:
column: useremail
table:
name: associations
schema: public
type: create_array_relationship

View File

@@ -0,0 +1,19 @@
- args:
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
type: run_sql
- args:
sql: "CREATE TABLE \"public\".\"jobs\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(),
\"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz
NOT NULL DEFAULT now(), \"shopid\" uuid NOT NULL, \"est_number\" text NOT NULL,
PRIMARY KEY (\"id\") , FOREIGN KEY (\"shopid\") REFERENCES \"public\".\"bodyshops\"(\"id\")
ON UPDATE restrict ON DELETE restrict);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_jobs_updated_at\"\nBEFORE
UPDATE ON \"public\".\"jobs\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
ON TRIGGER \"set_public_jobs_updated_at\" ON \"public\".\"jobs\" \nIS 'trigger
to set value of column \"updated_at\" to current timestamp on row update';\n"
type: run_sql
- args:
name: jobs
schema: public
type: add_existing_table_or_view

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: users
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,13 @@
- args:
permission:
allow_aggregations: false
columns:
- authid
- email
filter: {}
limit: null
role: user
table:
name: users
schema: public
type: create_select_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: users
schema: public
type: drop_update_permission

View File

@@ -0,0 +1,13 @@
- args:
permission:
columns: []
filter: {}
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: users
schema: public
type: create_update_permission

View File

@@ -0,0 +1,17 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns: []
computed_fields: []
filter: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -0,0 +1,19 @@
- args:
role: anonymous
table:
name: masterdata
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- key
- value
computed_fields: []
filter: {}
role: anonymous
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -0,0 +1,12 @@
- args:
relationship: jobs
table:
name: bodyshops
schema: public
type: drop_relationship
- args:
relationship: bodyshop
table:
name: jobs
schema: public
type: drop_relationship

View File

@@ -0,0 +1,20 @@
- args:
name: jobs
table:
name: bodyshops
schema: public
using:
foreign_key_constraint_on:
column: shopid
table:
name: jobs
schema: public
type: create_array_relationship
- args:
name: bodyshop
table:
name: jobs
schema: public
using:
foreign_key_constraint_on: shopid
type: create_object_relationship

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: jobs
schema: public
type: drop_insert_permission

View File

@@ -0,0 +1,24 @@
- args:
permission:
allow_upsert: true
check:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
columns:
- id
- created_at
- updated_at
- shopid
- est_number
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: jobs
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: jobs
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,21 @@
- args:
permission:
allow_aggregations: false
columns:
- est_number
- created_at
- updated_at
- id
- shopid
filter:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: jobs
schema: public
type: create_select_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: jobs
schema: public
type: drop_update_permission

View File

@@ -0,0 +1,23 @@
- args:
permission:
columns:
- est_number
- created_at
- updated_at
- id
- shopid
filter:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: jobs
schema: public
type: create_update_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: jobs
schema: public
type: drop_delete_permission

View File

@@ -0,0 +1,13 @@
- args:
permission:
filter:
bodyshop:
associations:
user:
authid:
_eq: X-Hasura-User-Id
role: user
table:
name: jobs
schema: public
type: create_delete_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,17 @@
- args:
permission:
allow_aggregations: false
columns:
- id
- shopname
filter:
associations:
user:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: bodyshops
schema: public
type: create_select_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: bodyshops
schema: public
type: drop_update_permission

View File

@@ -0,0 +1,18 @@
- args:
permission:
columns:
- shopname
filter:
associations:
user:
authid:
_eq: X-Hasura-User-Id
localPresets:
- key: ""
value: ""
set: {}
role: user
table:
name: bodyshops
schema: public
type: create_update_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: associations
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,17 @@
- args:
permission:
allow_aggregations: false
columns:
- id
- shopid
- useremail
filter:
user:
authid:
_eq: X-Hasura-User-Id
limit: null
role: user
table:
name: associations
schema: public
type: create_select_permission

View File

@@ -0,0 +1,6 @@
- args:
role: user
table:
name: masterdata
schema: public
type: drop_select_permission

View File

@@ -0,0 +1,11 @@
- args:
permission:
allow_aggregations: false
columns: []
filter: {}
limit: null
role: user
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -0,0 +1,17 @@
- args:
role: user
table:
name: masterdata
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns: []
computed_fields: []
filter: {}
role: user
table:
name: masterdata
schema: public
type: create_select_permission

View File

@@ -0,0 +1,19 @@
- args:
role: user
table:
name: masterdata
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- key
- value
computed_fields: []
filter: {}
role: user
table:
name: masterdata
schema: public
type: create_select_permission