Skip to content

Commit

Permalink
Merge branch 'main' into 16882_user_saved_views_ui
Browse files Browse the repository at this point in the history
  • Loading branch information
tillyw committed Feb 19, 2025
2 parents e7f53d9 + 9af54ae commit f3d5b6f
Show file tree
Hide file tree
Showing 80 changed files with 3,685 additions and 1,048 deletions.
245 changes: 60 additions & 185 deletions moped-database/metadata/tables.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
- table:
name: moped_project_types
schema: deprecated
object_relationships:
- name: moped_type
using:
foreign_key_constraint_on: project_type_id
- table:
name: moped_types
schema: deprecated
select_permissions:
- role: moped-admin
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- role: moped-editor
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- role: moped-viewer
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- table:
name: component_arcgis_online_view
schema: public
Expand Down Expand Up @@ -79,7 +123,6 @@
- substantial_completion_date
- substantial_completion_date_estimated
- task_order_names
- type_name
- workgroup_contractors
filter: {}
comment: ""
Expand Down Expand Up @@ -160,7 +203,6 @@
- substantial_completion_date
- substantial_completion_date_estimated
- task_order_names
- type_name
- workgroup_contractors
filter: {}
comment: ""
Expand Down Expand Up @@ -241,7 +283,6 @@
- substantial_completion_date
- substantial_completion_date_estimated
- task_order_names
- type_name
- workgroup_contractors
filter: {}
comment: ""
Expand Down Expand Up @@ -1669,37 +1710,40 @@
- role: moped-admin
permission:
columns:
- date_added
- department_id
- entity_id
- organization_id
- workgroup_id
- entity_name
- date_added
- entity_uuid
- is_deleted
- organization_id
- workgroup_id
filter: {}
allow_aggregations: true
- role: moped-editor
permission:
columns:
- date_added
- department_id
- entity_id
- organization_id
- workgroup_id
- entity_name
- date_added
- entity_uuid
- is_deleted
- organization_id
- workgroup_id
filter: {}
allow_aggregations: true
- role: moped-viewer
permission:
columns:
- date_added
- department_id
- entity_id
- organization_id
- workgroup_id
- entity_name
- date_added
- entity_uuid
- is_deleted
- organization_id
- workgroup_id
filter: {}
allow_aggregations: true
- table:
Expand Down Expand Up @@ -4309,7 +4353,7 @@
column: project_id
table:
name: moped_project_types
schema: public
schema: deprecated
- name: moped_projects
using:
foreign_key_constraint_on:
Expand Down Expand Up @@ -4784,138 +4828,6 @@
- project_role_name
- role_order
filter: {}
- table:
name: moped_project_types
schema: public
object_relationships:
- name: moped_type
using:
foreign_key_constraint_on: project_type_id
insert_permissions:
- role: moped-admin
permission:
check: {}
set:
created_by_user_id: x-hasura-user-db-id
updated_by_user_id: x-hasura-user-db-id
columns:
- is_deleted
- project_id
- project_type_id
- role: moped-editor
permission:
check: {}
set:
created_by_user_id: x-hasura-user-db-id
updated_by_user_id: x-hasura-user-db-id
columns:
- is_deleted
- project_id
- project_type_id
select_permissions:
- role: moped-admin
permission:
columns:
- created_at
- created_by_user_id
- id
- is_deleted
- project_id
- project_type_id
- updated_at
- updated_by_user_id
filter: {}
- role: moped-editor
permission:
columns:
- created_at
- created_by_user_id
- id
- is_deleted
- project_id
- project_type_id
- updated_at
- updated_by_user_id
filter: {}
- role: moped-viewer
permission:
columns:
- created_at
- created_by_user_id
- id
- is_deleted
- project_id
- project_type_id
- updated_at
- updated_by_user_id
filter: {}
update_permissions:
- role: moped-admin
permission:
columns:
- is_deleted
- project_id
- project_type_id
filter: {}
check: null
set:
updated_by_user_id: x-hasura-user-db-id
- role: moped-editor
permission:
columns:
- is_deleted
- project_id
- project_type_id
filter: {}
check: null
set:
updated_by_user_id: x-hasura-user-db-id
event_triggers:
- name: activity_log_moped_project_types
definition:
enable_manual: false
insert:
columns: '*'
update:
columns: '*'
retry_conf:
interval_sec: 10
num_retries: 0
timeout_sec: 60
webhook_from_env: HASURA_ENDPOINT
headers:
- name: x-hasura-admin-secret
value_from_env: ACTIVITY_LOG_API_SECRET
request_transform:
body:
action: transform
template: |-
{
"query": "mutation InsertActivity($object: moped_activity_log_insert_input!) { insert_moped_activity_log_one(object: $object) { activity_id } }",
"variables": {
"object": {
"record_id": {{ $body.event.data.new.id }},
"record_type": {{ $body.table.name }},
"activity_id": {{ $body.id }},
"record_project_id": {{ $body.event.data.new.project_id }},
"record_data": {"event": {{ $body.event }}},
"description": [{"newSchema": "true"}],
"operation_type": {{ $body.event.op }},
"updated_by_user_id": {{ $session_variables?['x-hasura-user-db-id'] ?? 1}}
}
}
}
method: POST
query_params: {}
template_engine: Kriti
version: 2
cleanup_config:
batch_size: 10000
clean_invocation_logs: false
clear_older_than: 168
paused: true
schedule: 0 0 * * *
timeout: 60
- table:
name: moped_public_process_statuses
schema: public
Expand Down Expand Up @@ -5034,43 +4946,6 @@
- slug
- is_deleted
filter: {}
- table:
name: moped_types
schema: public
select_permissions:
- role: moped-admin
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- role: moped-editor
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- role: moped-viewer
permission:
columns:
- type_name
- type_id
- active_type
- on_street
- sensitivity
- type_order
- date_added
filter: {}
- table:
name: moped_user_events
schema: public
Expand Down Expand Up @@ -5493,6 +5368,9 @@
- workgroup_name
filter: {}
allow_aggregations: true
- table:
name: project_funding_view
schema: public
- table:
name: project_geography
schema: public
Expand Down Expand Up @@ -5606,7 +5484,6 @@
- task_order_names
- task_order_names_short
- task_orders
- type_name
- updated_at
- workgroup_contractors
filter: {}
Expand Down Expand Up @@ -5659,7 +5536,6 @@
- task_order_names
- task_order_names_short
- task_orders
- type_name
- updated_at
- workgroup_contractors
filter: {}
Expand Down Expand Up @@ -5712,7 +5588,6 @@
- task_order_names
- task_order_names_short
- task_orders
- type_name
- updated_at
- workgroup_contractors
filter: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
INSERT INTO moped_project_roles (project_role_id, project_role_name, active_role, role_order, project_role_description)
VALUES (0, 'Unknown', TRUE, 999, 'Unknown Role');

UPDATE moped_project_roles
SET project_role_description = 'Supervises contractor activities for approval before invoicing; accepts work on behalf of ATD and coordinates with other divisions'
WHERE project_role_id = 12;

UPDATE moped_project_roles
SET project_role_name = 'ATD Project Owner'
WHERE project_role_id = 5;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
UPDATE moped_project_roles
SET project_role_name = 'TPW Project Owner'
WHERE project_role_id = 5;

UPDATE moped_project_roles
SET project_role_description = 'Supervises contractor activities for approval before invoicing; accepts work on behalf of TPW and coordinates with other divisions'
WHERE project_role_id = 12;

DELETE FROM moped_project_roles
WHERE project_role_id = 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP VIEW project_funding_view;
22 changes: 22 additions & 0 deletions moped-database/migrations/1736291471358_add_proj_fund_view/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE OR REPLACE VIEW project_funding_view AS
SELECT
mp.project_id,
mpf.proj_funding_id,
mpf.funding_amount,
mpf.funding_description,
mpf.fund_dept_unit,
mpf.created_at,
mpf.updated_at,
mfs.funding_source_name,
mfp.funding_program_name,
mfst.funding_status_name
FROM
moped_project AS mp
LEFT JOIN moped_proj_funding AS mpf ON mp.project_id = mpf.project_id
LEFT JOIN moped_fund_sources AS mfs ON mpf.funding_source_id = mfs.funding_source_id
LEFT JOIN moped_fund_programs AS mfp ON mpf.funding_program_id = mfp.funding_program_id
LEFT JOIN moped_fund_status AS mfst ON mpf.funding_status_id = mfst.funding_status_id
WHERE
TRUE
AND mp.is_deleted = FALSE
AND mpf.is_deleted = FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Updating moped_entity table will be up only. If we need to revert, we will need do it manually or
-- update with a future migration.
SELECT 0;
Loading

0 comments on commit f3d5b6f

Please sign in to comment.