Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(public-api): emailer to email notification with messages
- Loading branch information
1 parent
ef6286e
commit 276764f
Showing
6 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#![allow(dead_code)] | ||
|
||
pub mod api { | ||
use actix_swagger::{Answer, Api}; | ||
use actix_web::{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
pub trait Emailer { | ||
fn send(&self, email: String, content: String) -> bool; | ||
use serde::Serialize; | ||
|
||
pub trait EmailNotification { | ||
fn send(&self, email: String, content: EmailMessage) -> bool; | ||
} | ||
|
||
pub trait RegisterEmailer: Emailer { | ||
fn confirmation_code(&self, email: String, code: String) -> bool { | ||
let content = format!("Enter this code {}", code); | ||
self.send(email, content) | ||
} | ||
#[derive(Debug, Serialize)] | ||
pub enum EmailMessage { | ||
RegisterConfirmation { | ||
code: String, | ||
}, | ||
RegisterFinished { | ||
first_name: String, | ||
last_name: String, | ||
}, | ||
} |
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