We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1c25cc commit 665883dCopy full SHA for 665883d
src/app/controllers/PurchaseController.js
@@ -0,0 +1,23 @@
1
+const Ad = require('../models/Ad')
2
+// const User = require('../models/User')
3
+const Mail = require('../services/Mail')
4
+
5
+class PurchaseController {
6
+ async store (req, res) {
7
+ const { ad, content } = req.body
8
9
+ const purchaseAd = await Ad.findById(ad).populate('author')
10
+ // const user = await User.findById(req.userId)
11
12
+ await Mail.sendMail({
13
+ from: '"Rafael de Oliveira" <rafaoliverdev@gmail.com>',
14
+ to: purchaseAd.author.email,
15
+ subject: `Solicitação de compra: ${purchaseAd.title}`,
16
+ html: `<p>Teste: ${content}</p>`
17
+ })
18
19
+ return res.send()
20
+ }
21
+}
22
23
+module.exports = new PurchaseController()
0 commit comments