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 362c60e6
authored
2024-06-25 15:43:41 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
4ca0fce1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
36 deletions
src/api/vendor/controllers/vendor.js
src/api/vendor/services/sns.js
src/api/vendor/controllers/vendor.js
View file @
362c60e
...
...
@@ -74,9 +74,6 @@ module.exports = createCoreController("api::vendor.vendor", () => ({
);
const
date
=
new
Date
();
// TODO: Code to send OTP on email
const
subject
=
`New content created: OTP testing`
;
const
message
=
`Content:
${
oneTimePassword
}
`
;
await
strapi
.
services
[
"api::vendor.vendor"
].
sns
.
sendEmail
(
subject
,
message
);
// TODO: Code to send OTP on SMS
console
.
log
(
"ctx.request.body.data"
,
ctx
.
request
.
body
.
data
);
...
...
src/api/vendor/services/sns.js
deleted
100644 → 0
View file @
4ca0fce
// path: api/your-content-type/services/sns.js
const
AWS
=
require
(
'aws-sdk'
);
// Load environment variables
const
{
AWS_ACCESS_KEY_ID
,
AWS_ACCESS_SECRET
,
AWS_REGION
,
SNS_TOPIC_ARN
}
=
process
.
env
;
// Configure AWS SDK
AWS
.
config
.
update
({
accessKeyId
:
AWS_ACCESS_KEY_ID
,
secretAccessKey
:
AWS_ACCESS_SECRET
,
region
:
AWS_REGION
});
const
sns
=
new
AWS
.
SNS
();
module
.
exports
=
{
sendEmail
:
async
(
subject
,
message
)
=>
{
const
params
=
{
Message
:
message
,
Subject
:
subject
,
TopicArn
:
SNS_TOPIC_ARN
,
};
try
{
const
data
=
await
sns
.
publish
(
params
).
promise
();
console
.
log
(
`Message sent to SNS:
${
data
.
MessageId
}
`
);
return
data
;
}
catch
(
err
)
{
console
.
error
(
`Error publishing to SNS:
${
err
.
message
}
`
);
throw
err
;
}
},
};
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