Skip to content

Commit

Permalink
feat: computed column to retrive an operator's pending form change
Browse files Browse the repository at this point in the history
  • Loading branch information
pbastia committed Mar 4, 2022
1 parent 474bff7 commit ceb9b1d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24076,6 +24076,11 @@ type Operator implements Node {
"""
operatorCode: String

"""
Returns the pending form change editing the operator created by the current user, if it exists.
"""
pendingFormChange: FormChange

"""Reads and enables pagination through a set of `ProjectStatus`."""
projectStatusesByProjectOperatorIdAndProjectStatusId(
"""Read all values in the set after (below) this cursor."""
Expand Down
12 changes: 12 additions & 0 deletions app/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -81752,6 +81752,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pendingFormChange",
"description": "Returns the pending form change editing the operator created by the current user, if it exists.",
"args": [],
"type": {
"kind": "OBJECT",
"name": "FormChange",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "projectStatusesByProjectOperatorIdAndProjectStatusId",
"description": "Reads and enables pagination through a set of `ProjectStatus`.",
Expand Down
16 changes: 16 additions & 0 deletions schema/deploy/computed_columns/operator_pending_form_change.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Deploy cif:computed_columns/operator_pending_form_change to pg

begin;

create function cif.operator_pending_form_change(cif.operator) returns cif.form_change as $$
select * from cif.form_change
where form_data_schema_name = 'cif'
and form_data_table_name = 'operator'
and form_data_record_id = $1.id
and change_status = 'pending'
and created_by = (select id from cif.cif_user where uuid = (select sub from cif.session()));
$$ language sql stable;

comment on function cif.operator_pending_form_change(cif.operator) is 'Returns the pending form change editing the operator created by the current user, if it exists.';

commit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Revert cif:computed_columns/operator_pending_form_change from pg

begin;

drop function cif.operator_pending_form_change(cif.operator);

commit;
1 change: 1 addition & 0 deletions schema/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ computed_columns/project_revision_project_manager_form_change [tables/project_re
types/manager_form_changes_by_label_composite_return [schemas/main] 2022-02-18T20:58:37Z Dylan Leard <[email protected]> # Add custom composite return type for computed column project_revision_project_manager_form_changes_by_label
computed_columns/project_revision_project_manager_form_changes_by_label [tables/project_revision tables/project_manager] 2022-02-18T21:32:45Z Dylan Leard <[email protected]> # Computed column to retrieve the set of form changes related to the project manager association by project_manager_label, within a project revision
computed_columns/project_pending_project_revision 2022-02-16T17:14:03Z Matthieu Foucault <[email protected]> # add a computed column to return a pending revision for a project
computed_columns/operator_pending_form_change 2022-02-16T21:48:38Z Pierre Bastianelli <[email protected]> # A computed column returning a potential existing form change for an operator, scoped by the current user
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Verify cif:computed_columns/operator_pending_form_change on pg

BEGIN;

-- XXX Add verifications here.

ROLLBACK;

0 comments on commit ceb9b1d

Please sign in to comment.