diff --git a/src/app/functions/server/sanitize.ts b/src/app/functions/server/sanitize.ts index 07d84eaf4fa..42a1defc7ac 100644 --- a/src/app/functions/server/sanitize.ts +++ b/src/app/functions/server/sanitize.ts @@ -59,7 +59,7 @@ export type SanitizedSubscriberRow = SanitizationMarker & | "breaches_resolved" | "waitlists_joined" | "breach_stats" - | "monthly_email_optout" + | "monthly_monitor_report" | "onerep_profile_id" | "email_addresses" >; @@ -88,7 +88,7 @@ export function sanitizeSubscriberRow( breaches_resolved: subscriber.breaches_resolved, waitlists_joined: subscriber.waitlists_joined, breach_stats: subscriber.breach_stats, - monthly_email_optout: subscriber.monthly_email_optout, + monthly_monitor_report: subscriber.monthly_monitor_report, onerep_profile_id: subscriber.onerep_profile_id, email_addresses: subscriber.email_addresses, // If we want to avoid passing this property to the client-side, we can also diff --git a/src/db/migrations/20240408161125_add_monthly_report_column.js b/src/db/migrations/20240408161125_add_monthly_report_column.js new file mode 100644 index 00000000000..77952feab7b --- /dev/null +++ b/src/db/migrations/20240408161125_add_monthly_report_column.js @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +export function up (knex) { + return knex.schema.table('subscribers', table => { + table.dropColumn("monthly_email_optout") + table.dropColumn("monthly_email_at") + table.boolean('monthly_monitor_report').defaultTo(true) + table.timestamp('monthly_monitor_report_at') + }) +} + +export function down (knex) { + return knex.schema.table('subscribers', table => { + table.boolean('monthly_email_optout') + table.timestamp('monthly_email_at') + table.dropColumn('monthly_monitor_report') + table.dropColumn("monthly_monitor_report_at") + }) +} diff --git a/src/db/seeds/testSubscribers.js b/src/db/seeds/testSubscribers.js index 66c02c515d1..05060376d82 100644 --- a/src/db/seeds/testSubscribers.js +++ b/src/db/seeds/testSubscribers.js @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// OBSOLETE: Delete as a part of MNTOR-3077 'use strict' import { getSha1 } from '../../utils/fxa.js' diff --git a/src/db/tables/subscribers.js b/src/db/tables/subscribers.js index 89a93dcf0fd..db96867ed81 100644 --- a/src/db/tables/subscribers.js +++ b/src/db/tables/subscribers.js @@ -292,6 +292,7 @@ async function updateMonthlyEmailTimestamp (email) { /* c8 ignore stop */ /** + * OBSOLETE: Delete as a part of MNTOR-3077 * Unsubscribe user from monthly unresolved breach emails * * @param {string} token User verification token @@ -318,6 +319,7 @@ async function getOnerepProfileId (subscriberId) { } /* c8 ignore stop */ +// OBSOLETE: Delete as a part of MNTOR-3077 // Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy /* c8 ignore start */ function getSubscribersWithUnresolvedBreachesQuery () { @@ -328,6 +330,7 @@ function getSubscribersWithUnresolvedBreachesQuery () { } /* c8 ignore stop */ +// OBSOLETE: Delete as a part of MNTOR-3077 // Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy /* c8 ignore start */ async function getSubscribersWithUnresolvedBreaches (limit = 0) { @@ -340,6 +343,7 @@ async function getSubscribersWithUnresolvedBreaches (limit = 0) { } /* c8 ignore stop */ +// OBSOLETE: Delete as a part of MNTOR-3077 // Not covered by tests; mostly side-effects. See test-coverage.md#mock-heavy /* c8 ignore start */ async function getSubscribersWithUnresolvedBreachesCount () { diff --git a/src/knex-tables.d.ts b/src/knex-tables.d.ts index b7e86cf81eb..7cac6d06b52 100644 --- a/src/knex-tables.d.ts +++ b/src/knex-tables.d.ts @@ -109,10 +109,10 @@ declare module "knex/types/tables" { }; // TODO: Find unknown type // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - monthly_email_at: null | unknown; + monthly_monitor_report_at: null | unknown; // TODO: Find unknown type // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - monthly_email_optout: null | unknown; + monthly_monitor_report: boolean; breach_resolution: | null | ({ @@ -149,8 +149,8 @@ declare module "knex/types/tables" { | "breaches_resolved" | "waitlists_joined" | "breach_stats" - | "monthly_email_at" - | "monthly_email_optout" + | "monthly_monitor_report_at" + | "monthly_monitor_report" | "breach_resolution" | "db_migration_1" | "db_migration_2"