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

feat(notifications): implement email reminder use case #4216

Merged
merged 15 commits into from
Mar 22, 2024

Conversation

thevaibhav-dixit
Copy link
Contributor

No description provided.

@@ -120,6 +120,7 @@ pub enum UserNotificationCategory {
AdminNotification,
Marketing,
Price,
Onboarding,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not Onboarding - its security right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could fit in both categories

) -> Result<(), JobError> {
let data = data.into();
// TODO: I think reusing the id here might cause a bug
match JobBuilder::new_with_id(LINK_EMAIL_REMINDER_ID, "link_email_reminder")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are recursively calling back into this for pagination I think this may be a bug @thevaibhav-dixit @bodymindarts

Comment on lines 19 to 21
const ACCOUNT_LIVENESS_THRESHOLD_DAYS: i64 = 21;
const ACCOUNT_AGED_THRESHOLD_DAYS: i64 = 21;
const NOTIFICATION_COOL_OFF_THRESHOLD_DAYS: i64 = 90;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not directly convert to duration here ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@@ -74,6 +74,7 @@ impl From<UserNotificationCategory> for proto::NotificationCategory {
}
UserNotificationCategory::Marketing => proto::NotificationCategory::Marketing,
UserNotificationCategory::Price => proto::NotificationCategory::Price,
_ => unimplemented!(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must remove

tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
search_id: GaloyUserId,
) -> Result<(Vec<GaloyUserId>, bool), EmailReminderProjectionError> {
let last_transaction_at_threshold = Utc::now()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put math into SQL query

const ACCOUNT_AGED_THRESHOLD_DAYS: i64 = 21;
const NOTIFICATION_COOL_OFF_THRESHOLD_DAYS: i64 = 90;

pub fn new(pool: &PgPool) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add constants as config.

@thevaibhav-dixit thevaibhav-dixit changed the title chore(notifications): boilerplate for linking email use case feat(notifications): implement email reminder use case Mar 22, 2024
@thevaibhav-dixit thevaibhav-dixit marked this pull request as ready for review March 22, 2024 10:01
@@ -60,3 +60,6 @@ transaction.paid_invoice.body_display_currency: "+%{displayCurrencyAmount} | %{f

price_changed.title: "Bitcoin is on the move!"
price_changed.body: "Bitcoin is up %{percent_increase}% in the last day to %{price}!"

onboarding.link_email_reminder.title: "Link Email to Secure Account"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: change this to security

bodymindarts
bodymindarts previously approved these changes Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants