Add payment number and date. IO-610

This commit is contained in:
Patrick Fic
2021-02-08 11:07:48 -08:00
parent f14b665e26
commit 1d091ac98d
35 changed files with 679 additions and 32 deletions

View File

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

View File

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

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- stripeid
- transactionid
- type
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: payments
schema: public
type: create_select_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: payments
schema: public
type: create_select_permission

View File

@@ -0,0 +1,36 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- stripeid
- transactionid
- type
- updated_at
set: {}
role: user
table:
name: payments
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
set: {}
role: user
table:
name: payments
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,36 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

@@ -0,0 +1,36 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

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

View File

@@ -0,0 +1,10 @@
- args:
cascade: true
read_only: false
sql: "CREATE OR REPLACE FUNCTION public.assign_payment_number ()\n\tRETURNS TRIGGER\n\tLANGUAGE
plpgsql\n\tAS $function$\nBEGIN\n\tIF (new.paymentnum IS NULL\n\t\tOR new.paymentnum
= 'pnew') THEN\n\tUPDATE\n\t\tcounters\n\tSET\n\t\tcount = count + 1\n\tFROM\n\t\tbodyshops\n\tWHERE\n\t\tbodyshops.id
= (\n\t\t\tSELECT\n\t\t\t\tshopid\n\t\t\tFROM\n\t\t\t\tjobs\n\t\t\tWHERE\n\t\t\t\tjobs.id
= new.jobid)\n\t\t\tAND countertype = 'paymentnum'\n\t\tRETURNING\n\t\t\tconcat(prefix,
count) INTO new.paymentnum;\nEND IF;\n\tRETURN NEW;\nEND;\n$function$;"
type: run_sql

View File

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

View File

@@ -0,0 +1,10 @@
- args:
cascade: true
read_only: false
sql: |-
create trigger payments_assign_paymentnum before
insert
on
public.payments
for each row execute procedure assign_payment_number();
type: run_sql

View File

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

View File

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

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
set: {}
role: user
table:
name: payments
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
set: {}
role: user
table:
name: payments
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: payments
schema: public
type: create_select_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: payments
schema: public
type: create_select_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: payments
schema: public
type: drop_update_permission
- args:
permission:
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: payments
schema: public
type: create_update_permission

View File

@@ -3488,11 +3488,13 @@ tables:
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
@@ -3503,11 +3505,13 @@ tables:
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type
@@ -3529,11 +3533,13 @@ tables:
columns:
- amount
- created_at
- date
- exportedat
- id
- jobid
- memo
- payer
- paymentnum
- stripeid
- transactionid
- type