Skip to content

Commit

Permalink
Merge pull request #3367 from GSA-TTS/main
Browse files Browse the repository at this point in the history
  • Loading branch information
jadudm authored Feb 7, 2024
2 parents d13faad + e8b54ec commit c7b0441
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
73 changes: 41 additions & 32 deletions backend/dissemination/api/api_v1_0_3/create_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ create view api_v1_0_3.findings_text as
dissemination_findingtext ft,
dissemination_general gen
where
(ft.report_id = gen.report_id
ft.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by ft.id
;

Expand All @@ -37,10 +38,11 @@ create view api_v1_0_3.additional_ueis as
dissemination_general gen,
dissemination_additionaluei uei
where
(gen.report_id = uei.report_id
gen.report_id = uei.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by uei.id
;

Expand All @@ -67,10 +69,11 @@ create view api_v1_0_3.findings as
dissemination_finding finding,
dissemination_general gen
where
(finding.report_id = gen.report_id
finding.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by finding.id
;

Expand All @@ -79,7 +82,7 @@ create view api_v1_0_3.findings as
---------------------------------------
create view api_v1_0_3.federal_awards as
select
gen.report_id,
award.report_id,
gen.auditee_uei,
gen.audit_year,
---
Expand All @@ -106,10 +109,11 @@ create view api_v1_0_3.federal_awards as
dissemination_federalaward award,
dissemination_general gen
where
(award.report_id = gen.report_id
award.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by award.id
;

Expand All @@ -130,10 +134,11 @@ create view api_v1_0_3.corrective_action_plans as
dissemination_CAPText ct,
dissemination_General gen
where
(ct.report_id = gen.report_id
ct.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by ct.id
;

Expand All @@ -156,10 +161,11 @@ create view api_v1_0_3.notes_to_sefa as
dissemination_general gen,
dissemination_note note
where
(note.report_id = gen.report_id
note.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by note.id
;

Expand All @@ -179,10 +185,11 @@ create view api_v1_0_3.passthrough as
dissemination_general as gen,
dissemination_passthrough as pass
where
(gen.report_id = pass.report_id
gen.report_id = pass.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by pass.id
;

Expand Down Expand Up @@ -267,10 +274,11 @@ create view api_v1_0_3.general as
dissemination_General gen,
audit_singleauditchecklist aud
where
(aud.report_id = gen.report_id
aud.report_id = gen.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by gen.id
;

Expand All @@ -297,10 +305,11 @@ create view api_v1_0_3.secondary_auditors as
dissemination_General gen,
dissemination_SecondaryAuditor sa
where
(sa.report_id = gen.report_id
sa.report_id = gen.report_id
and
gen.is_public=True)
or (gen.is_public=false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public=True
or
(gen.is_public=false and api_v1_0_3_functions.has_tribal_data_access()))
order by sa.id
;

Expand All @@ -315,14 +324,14 @@ create view api_v1_0_3.additional_eins as
dissemination_general gen,
dissemination_additionalein ein
where
(gen.report_id = ein.report_id
gen.report_id = ein.report_id
and
gen.is_public = true)
or (gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access())
(gen.is_public = true
or
(gen.is_public = false and api_v1_0_3_functions.has_tribal_data_access()))
order by ein.id
;


commit;

notify pgrst,
Expand Down
2 changes: 2 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ services:
# See https://postgrest.org/en/stable/references/api/schemas.html#multiple-schemas for multiple schemas
PGRST_DB_SCHEMAS: "api_v1_0_3, admin_api_v1_0_0"
PGRST_JWT_SECRET: ${PGRST_JWT_SECRET:-32_chars_fallback_secret_testing} # Fallback value for testing environments
# Enable this to inspect the DB plans for queries via EXPLAIN
PGRST_DB_PLAN_ENABLED: ${PGRST_DB_PLAN_ENABLED:-false}
depends_on:
db:
condition: service_healthy
Expand Down
3 changes: 3 additions & 0 deletions terraform/meta/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ locals {
# https://github.com/orgs/GSA-TTS/teams/fac-admins/members
# TODO: Automate updates via GitHub's GraphQL API
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
]

internal_asgs = [
Expand Down
1 change: 1 addition & 0 deletions terraform/production/production.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module "production" {
cf_space_name = "production"
new_relic_license_key = var.new_relic_license_key
pgrst_jwt_secret = var.pgrst_jwt_secret
database_plan = "xlarge-gp-psql-redundant"
}

# Note: The very first time we run apply in production, this will fail because
Expand Down

0 comments on commit c7b0441

Please sign in to comment.