Commit bddef877 by jaymehta

.

1 parent cfaa6e42
{
"kind": "collectionType",
"collectionName": "notifications",
"info": {
"singularName": "notification",
"pluralName": "notifications",
"displayName": "Notification",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"users_permissions_user": {
"type": "relation",
"relation": "manyToOne",
"target": "plugin::users-permissions.user",
"inversedBy": "notifications"
},
"text": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"type": "enumeration",
"enum": [
"approved",
"rejected",
"pending"
]
},
"status": {
"type": "enumeration",
"enum": [
"seen",
"pending"
]
}
}
}
'use strict';
/**
* notification controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::notification.notification');
'use strict';
/**
* notification router
*/
const { createCoreRouter } = require('@strapi/strapi').factories;
module.exports = createCoreRouter('api::notification.notification');
'use strict';
/**
* notification service
*/
const { createCoreService } = require('@strapi/strapi').factories;
module.exports = createCoreService('api::notification.notification');
......@@ -213,22 +213,22 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
// Generate an HTML email with the provided contents
var emailBody = mailGenerator.generate(email);
console.log("email", emailBody);
// console.log("email", emailBody);
var transport = nodemailer.createTransport({
host: "sandbox.smtp.mailtrap.io",
port: 2525,
host: process.env.SMTP_HOST,
port: process.env.SMTP_PORT,
auth: {
user: "7779108f5d4590",
pass: "cbcba36dcf85ba",
user: process.env.SMTP_USERNAME,
pass: process.env.SMTP_PASSWORD,
},
});
async function main() {
// send mail with defined transport object
const info = await transport.sendMail({
from: "Team Zango <graheja@zangoexperiences.com>", // sender address
to: "jay@logicloop.io", // list of receivers
from: "Team Zango<no-reply@zango.com>", // sender address
to: ctx.request.body.email, // list of receivers
subject: "OTP Verification", // Subject line
// text: "Hello world?", // plain text body
html: emailBody, // html body
......@@ -238,6 +238,8 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
// Message sent: <d786aa62-4e0a-070a-47ed-0b0666549519@ethereal.email>
}
main().catch(console.error);
ctx.send({ok: true, message: "Email sent"})
},
async addVendorId(ctx) {
......
......@@ -88,6 +88,12 @@
"relation": "oneToOne",
"target": "api::end-user.end-user",
"mappedBy": "user"
},
"notifications": {
"type": "relation",
"relation": "oneToMany",
"target": "api::notification.notification",
"mappedBy": "users_permissions_user"
}
}
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!