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

MNTOR-3919: getting setter for churn email state (Part 2) #5480

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const mockedSubscriber: SubscriberRow = {
monthly_monitor_report: false,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

const mockedUser: Session["user"] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const mockedSubscriber: SubscriberRow = {
monthly_monitor_report: false,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

const mockedUser: Session["user"] = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* 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/. */

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function up (knex) {
return knex.schema.table("subscribers", table => {
table.boolean("churn_prevention_email_sent").defaultTo(false);
table.index("churn_prevention_email_sent");
});
}

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function down (knex) {
return knex.schema.table("subscribers", table => {
table.dropIndex("churn_prevention_email_sent")
table.dropColumn("churn_prevention_email_sent");
});
}
2 changes: 2 additions & 0 deletions src/knex-tables.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ declare module "knex/types/tables" {
sign_in_count: null | number;
email_addresses: SubscriberEmail[];
first_broker_removal_email_sent: boolean;
churn_prevention_email_sent: boolean;
}
type SubscriberOptionalColumns = Extract<
keyof SubscriberRow,
Expand All @@ -174,6 +175,7 @@ declare module "knex/types/tables" {
| "onerep_profile_id"
| "email_addresses"
| "first_broker_removal_email_sent"
| "churn_prevention_email_sent"
>;
type SubscriberAutoInsertedColumns = Extract<
keyof SubscriberRow,
Expand Down
7 changes: 7 additions & 0 deletions src/utils/subscriberBreaches.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const subscriber: SubscriberRow = {
monthly_monitor_report: false,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

const allBreaches: HibpLikeDbBreach[] = [
Expand Down Expand Up @@ -550,6 +551,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down Expand Up @@ -649,6 +651,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down Expand Up @@ -756,6 +759,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down Expand Up @@ -873,6 +877,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down Expand Up @@ -990,6 +995,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down Expand Up @@ -1103,6 +1109,7 @@ describe("getSubBreaches", () => {
onerep_profile_id: null,
sign_in_count: null,
first_broker_removal_email_sent: false,
churn_prevention_email_sent: false,
};

(
Expand Down
Loading