-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactored queue mail provider
- Loading branch information
Showing
5 changed files
with
28 additions
and
47 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
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
7 changes: 4 additions & 3 deletions
7
src/infra/providers/QueueProvider/models/IMailQueueProvider.ts
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,35 +1,31 @@ | ||
import { AppContainer } from '~infra/bootstrap/container'; | ||
import IMailProvider from '~infra/providers/MailProvider/models/IMailProvider'; | ||
import IMailQueueProvider from '~infra/providers/QueueProvider/models/IMailQueueProvider'; | ||
import { Logger } from '~infra/tools/log/types'; | ||
|
||
class SendMail { | ||
private logger: Logger; | ||
private mailQueueProvider: IMailQueueProvider; | ||
|
||
constructor(params: AppContainer) { | ||
this.logger = params.logger; | ||
this.mailQueueProvider = params.mailQueueProvider; | ||
} | ||
|
||
public async execute(input: string): Promise<void> { | ||
// await this.mailProvider.sendMail({ | ||
// from: { | ||
// email: '[email protected]', | ||
// name: 'deusimar', | ||
// }, | ||
// html: '<div><p>Olá {{name}}</p></div>', | ||
// subject: 'Ola test', | ||
// to: { | ||
// email: '[email protected]', | ||
// name: 'deusimar', | ||
// }, | ||
// variables: { | ||
// name: input, | ||
// }, | ||
// }); | ||
|
||
await this.mailQueueProvider.addJob('Oi'); | ||
await this.mailQueueProvider.addJob({ | ||
data: { | ||
from: { | ||
email: 'deusimar@deusimar.com', | ||
name: 'deusimar', | ||
}, | ||
html: '<div><strong>Olá {{name}}</strong></div>', | ||
subject: 'Ola test', | ||
to: { | ||
email: 'deusimar@deusimar.com', | ||
name: 'deusimar', | ||
}, | ||
variables: { | ||
name: input, | ||
}, | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
|