-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generic function to retrieve a pending form change for a user
- Loading branch information
Showing
7 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
schema/deploy/functions/pending_new_form_change_for_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Deploy cif:functions/pending_new_form_change_for_table to pg | ||
|
||
begin; | ||
|
||
create function cif.pending_new_form_change_for_table(tableName text) returns cif.form_change as | ||
$$ | ||
select * from cif.form_change | ||
where form_data_table_name = quote_literal($1) | ||
and form_data_schema_name = 'cif' | ||
and operation = 'create' | ||
and change_status = 'pending' | ||
and created_by = (select id from cif.cif_user where uuid = (select sub from cif.session())) | ||
limit 1; | ||
$$ language 'sql' stable; | ||
|
||
comment on function cif.pending_new_form_change_for_table(text) is | ||
'returns a form_change for a table in the pending state for the current user, i.e. allows to resume the creation of any table row'; | ||
commit; |
7 changes: 7 additions & 0 deletions
7
schema/revert/functions/pending_new_form_change_for_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Revert cif:functions/pending_new_form_change_for_table from pg | ||
|
||
begin; | ||
|
||
drop function cif.pending_new_form_change_for_table(text); | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
schema/verify/functions/pending_new_form_change_for_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Verify cif:functions/pending_new_form_change_for_table on pg | ||
|
||
begin; | ||
|
||
select pg_get_functiondef('cif.pending_new_form_change_for_table(text)'::regprocedure); | ||
|
||
rollback; |