Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-strapi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit bddef877
authored
2024-07-10 21:04:36 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
cfaa6e42
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
7 deletions
src/api/notification/content-types/notification/schema.json
src/api/notification/controllers/notification.js
src/api/notification/routes/notification.js
src/api/notification/services/notification.js
src/api/vendor/controllers/vendor.js
src/extensions/users-permissions/content-types/user/schema.json
src/api/notification/content-types/notification/schema.json
0 → 100644
View file @
bddef87
{
"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"
]
}
}
}
src/api/notification/controllers/notification.js
0 → 100644
View file @
bddef87
'use strict'
;
/**
* notification controller
*/
const
{
createCoreController
}
=
require
(
'@strapi/strapi'
).
factories
;
module
.
exports
=
createCoreController
(
'api::notification.notification'
);
src/api/notification/routes/notification.js
0 → 100644
View file @
bddef87
'use strict'
;
/**
* notification router
*/
const
{
createCoreRouter
}
=
require
(
'@strapi/strapi'
).
factories
;
module
.
exports
=
createCoreRouter
(
'api::notification.notification'
);
src/api/notification/services/notification.js
0 → 100644
View file @
bddef87
'use strict'
;
/**
* notification service
*/
const
{
createCoreService
}
=
require
(
'@strapi/strapi'
).
factories
;
module
.
exports
=
createCoreService
(
'api::notification.notification'
);
src/api/vendor/controllers/vendor.js
View file @
bddef87
...
...
@@ -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
)
{
...
...
src/extensions/users-permissions/content-types/user/schema.json
View file @
bddef87
...
...
@@ -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"
}
}
}
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment