-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove invalid assertions and returning() calls
Knex's returning() API is intended for INSERT, UPDATE and DELETE calls, not SELECTs: https://knexjs.org/guide/query-builder.html#returning I've updated the .where() queries to replace the returning() calls, i.e. by making them select all columns. I then also removed the type assertions, so as to not indicate that rows will always be returned even in cases where they might not be available. The type assertion also pretended that the `monthly_monitor_report_free` column could only be `boolean | undefined`, even though it can be `null` too (see `addUnsubcribeTokenForSubscriber`, which sets it to `null`).
- Loading branch information
Showing
4 changed files
with
36 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,25 +226,25 @@ const mockedSubscriptionBillingAmount = { | |
yearly: 13.37, | ||
monthly: 42.42, | ||
}; | ||
const mockedPlusSubscriberEmailPreferences: SubscriberEmailPreferencesOutput = { | ||
const mockedPlusSubscriberEmailPreferences = { | ||
id: 1337, | ||
primary_email: "[email protected]", | ||
unsubscribe_token: "495398jfjvjfdj", | ||
monthly_monitor_report_free: false, | ||
monthly_monitor_report_free_at: new Date("1337-04-02T04:02:42.000Z"), | ||
monthly_monitor_report: true, | ||
monthly_monitor_report_at: new Date("1337-04-02T04:02:42.000Z"), | ||
}; | ||
} as SubscriberEmailPreferencesOutput; | ||
|
||
const mockedFreeSubscriberEmailPreferences: SubscriberEmailPreferencesOutput = { | ||
const mockedFreeSubscriberEmailPreferences = { | ||
id: 1337, | ||
primary_email: "[email protected]", | ||
unsubscribe_token: "495398jfjvjfdj", | ||
monthly_monitor_report_free: true, | ||
monthly_monitor_report_free_at: new Date("1337-04-02T04:02:42.000Z"), | ||
monthly_monitor_report: false, | ||
monthly_monitor_report_at: new Date("1337-04-02T04:02:42.000Z"), | ||
}; | ||
} as SubscriberEmailPreferencesOutput; | ||
|
||
const mockedSession = { | ||
expires: new Date().toISOString(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters