IO-992 Job Audit Logs

This commit is contained in:
Patrick Fic
2021-07-22 16:29:41 -07:00
parent 97aecd3ddc
commit 6b811d635b
48 changed files with 1263 additions and 961 deletions

View File

@@ -0,0 +1,29 @@
- args:
permission:
allow_aggregations: false
columns:
- id
- new_val
- old_val
- operation
- schemaname
- tabname
- useremail
- created
- bodyshopid
- recordid
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: audit_trail
schema: public
type: create_select_permission

View File

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

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ADD COLUMN "schemaname" text;
type: run_sql
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ALTER COLUMN "schemaname" DROP NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" DROP COLUMN "schemaname" CASCADE;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ADD COLUMN "tabname" text;
type: run_sql
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ALTER COLUMN "tabname" DROP NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" DROP COLUMN "tabname" CASCADE;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ADD COLUMN "recordid" uuid;
type: run_sql
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ALTER COLUMN "recordid" DROP NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" DROP COLUMN "recordid" CASCADE;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" DROP COLUMN "jobid";
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ADD COLUMN "jobid" uuid NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" DROP COLUMN "billid";
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."audit_trail" ADD COLUMN "billid" uuid NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."audit_trail" drop constraint "audit_trail_billid_fkey";
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail"
add constraint "audit_trail_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id") on update cascade on delete cascade;
type: run_sql

View File

@@ -0,0 +1,12 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_billid_fkey",
add constraint "audit_trail_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id")
on update cascade
on delete cascade;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_billid_fkey",
add constraint "audit_trail_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id") on update cascade on delete set null;
type: run_sql

View File

@@ -0,0 +1,12 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_billid_fkey",
add constraint "audit_trail_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id")
on update cascade
on delete set null;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_billid_fkey",
add constraint "audit_trail_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id") on update cascade on delete set null;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."audit_trail" drop constraint "audit_trail_jobid_fkey";
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail"
add constraint "audit_trail_jobid_fkey"
foreign key ("jobid")
references "public"."jobs"
("id") on update cascade on delete set null;
type: run_sql

View File

@@ -0,0 +1,12 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_useremail_fkey",
add constraint "audit_trail_useremail_fkey"
foreign key ("useremail")
references "public"."users"
("email")
on update restrict
on delete restrict;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."audit_trail" drop constraint "audit_trail_useremail_fkey",
add constraint "audit_trail_useremail_fkey"
foreign key ("useremail")
references "public"."users"
("email") on update cascade on delete set null;
type: run_sql

View File

@@ -0,0 +1,24 @@
- args:
relationship: audit_trails
table:
name: jobs
schema: public
type: drop_relationship
- args:
relationship: audit_trails
table:
name: bills
schema: public
type: drop_relationship
- args:
relationship: job
table:
name: audit_trail
schema: public
type: drop_relationship
- args:
relationship: bill
table:
name: audit_trail
schema: public
type: drop_relationship

View File

@@ -0,0 +1,40 @@
- args:
name: audit_trails
table:
name: jobs
schema: public
using:
foreign_key_constraint_on:
column: jobid
table:
name: audit_trail
schema: public
type: create_array_relationship
- args:
name: audit_trails
table:
name: bills
schema: public
using:
foreign_key_constraint_on:
column: billid
table:
name: audit_trail
schema: public
type: create_array_relationship
- args:
name: job
table:
name: audit_trail
schema: public
using:
foreign_key_constraint_on: jobid
type: create_object_relationship
- args:
name: bill
table:
name: audit_trail
schema: public
using:
foreign_key_constraint_on: billid
type: create_object_relationship

View File

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

View File

@@ -0,0 +1,29 @@
- args:
permission:
allow_upsert: true
backend_only: false
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created
- operation
- new_val
- old_val
- useremail
- bodyshopid
- jobid
- billid
set: {}
role: user
table:
name: audit_trail
schema: public
type: create_insert_permission

View File

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

View File

@@ -0,0 +1,30 @@
- args:
permission:
allow_aggregations: false
backend_only: false
columns:
- id
- new_val
- old_val
- operation
- useremail
- created
- billid
- bodyshopid
- jobid
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
limit: null
role: user
table:
name: audit_trail
schema: public
type: create_select_permission

View File

@@ -226,12 +226,41 @@ tables:
schema: public
name: audit_trail
object_relationships:
- name: bill
using:
foreign_key_constraint_on: billid
- name: bodyshop
using:
foreign_key_constraint_on: bodyshopid
- name: job
using:
foreign_key_constraint_on: jobid
- name: user
using:
foreign_key_constraint_on: useremail
insert_permissions:
- role: user
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created
- operation
- new_val
- old_val
- useremail
- bodyshopid
- jobid
- billid
backend_only: false
select_permissions:
- role: user
permission:
@@ -240,12 +269,11 @@ tables:
- new_val
- old_val
- operation
- schemaname
- tabname
- useremail
- created
- billid
- bodyshopid
- recordid
- jobid
filter:
bodyshop:
associations:
@@ -480,6 +508,13 @@ tables:
using:
foreign_key_constraint_on: vendorid
array_relationships:
- name: audit_trails
using:
foreign_key_constraint_on:
column: billid
table:
schema: public
name: audit_trail
- name: billlines
using:
foreign_key_constraint_on:
@@ -2248,6 +2283,13 @@ tables:
table:
schema: public
name: appointments
- name: audit_trails
using:
foreign_key_constraint_on:
column: jobid
table:
schema: public
name: audit_trail
- name: available_jobs
using:
foreign_key_constraint_on: