Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove submission_email column from teams table #3640

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,6 @@
- notify_personalisation
- settings
- slug
- submission_email
- updated_at
select_permissions:
- role: api
Expand All @@ -2070,7 +2069,6 @@
- reference_code
- settings
- slug
- submission_email
- updated_at
computed_fields:
- boundary_bbox
Expand Down Expand Up @@ -2130,7 +2128,6 @@
- notify_personalisation
- settings
- slug
- submission_email
filter: {}
check: null
- table:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
alter table "public"."teams" add column "submission_email" text;
comment on column "public"."teams"."submission_email" is E'Referenced by Send component when configured to email planning office';


CREATE OR REPLACE VIEW "public"."teams_summary" AS
SELECT t.id,
t.name,
t.slug,
t.reference_code,
(t.settings ->> 'homepage'::text) AS homepage,
t.domain AS subdomain,
ti.has_planning_data AS planning_data_enabled,
'@todo'::text AS article_4s_enabled,
jsonb_build_object('helpEmail', ts.help_email, 'helpPhone', ts.help_phone, 'emailReplyToId', ts.email_reply_to_id, 'helpOpeningHours', ts.help_opening_hours) AS govnotify_personalisation,
CASE
WHEN (COALESCE(ti.production_govpay_secret, ti.staging_govpay_secret) IS NOT NULL) THEN true
ELSE false
END AS govpay_enabled,
t.submission_email AS send_to_email_address,
COALESCE(ti.production_bops_submission_url, ti.staging_bops_submission_url) AS bops_submission_url,
tt.logo,
tt.favicon,
tt.primary_colour,
tt.link_colour,
tt.action_colour
FROM (((teams t
JOIN team_integrations ti ON ((ti.team_id = t.id)))
JOIN team_themes tt ON ((tt.team_id = t.id)))
JOIN team_settings ts ON ((ts.team_id = t.id)))
ORDER BY t.name;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

CREATE OR REPLACE VIEW "public"."teams_summary" AS
SELECT t.id,
t.name,
t.slug,
t.reference_code,
ts.homepage AS homepage,
t.domain AS subdomain,
ti.has_planning_data AS planning_data_enabled,
'@todo'::text AS article_4s_enabled,
jsonb_build_object('helpEmail', ts.help_email, 'helpPhone', ts.help_phone, 'emailReplyToId', ts.email_reply_to_id, 'helpOpeningHours', ts.help_opening_hours) AS govnotify_personalisation,
CASE
WHEN (COALESCE(ti.production_govpay_secret, ti.staging_govpay_secret) IS NOT NULL) THEN true
ELSE false
END AS govpay_enabled,
ts.submission_email AS send_to_email_address,
RODO94 marked this conversation as resolved.
Show resolved Hide resolved
COALESCE(ti.production_bops_submission_url, ti.staging_bops_submission_url) AS bops_submission_url,
tt.logo,
tt.favicon,
tt.primary_colour,
tt.link_colour,
tt.action_colour
FROM (((teams t
JOIN team_integrations ti ON ((ti.team_id = t.id)))
JOIN team_themes tt ON ((tt.team_id = t.id)))
JOIN team_settings ts ON ((ts.team_id = t.id)))
ORDER BY t.name;


alter table "public"."teams" drop column "submission_email" cascade;
1 change: 0 additions & 1 deletion scripts/seed-database/write/teams.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CREATE TEMPORARY TABLE sync_teams (
settings jsonb,
notify_personalisation jsonb,
domain text,
submission_email text,
boundary jsonb,
reference_code text
);
Expand Down
Loading