@@ -0,0 +1,52 @@ | |||
{ | |||
"routes": [ | |||
{ | |||
"method": "GET", | |||
"path": "/template-emails", | |||
"handler": "template-email.find", | |||
"config": { | |||
"policies": [] | |||
} | |||
}, | |||
{ | |||
"method": "GET", | |||
"path": "/template-emails/count", | |||
"handler": "template-email.count", | |||
"config": { | |||
"policies": [] | |||
} | |||
}, | |||
{ | |||
"method": "GET", | |||
"path": "/template-emails/:id", | |||
"handler": "template-email.findOne", | |||
"config": { | |||
"policies": [] | |||
} | |||
}, | |||
{ | |||
"method": "POST", | |||
"path": "/template-emails", | |||
"handler": "template-email.create", | |||
"config": { | |||
"policies": [] | |||
} | |||
}, | |||
{ | |||
"method": "PUT", | |||
"path": "/template-emails/:id", | |||
"handler": "template-email.update", | |||
"config": { | |||
"policies": [] | |||
} | |||
}, | |||
{ | |||
"method": "DELETE", | |||
"path": "/template-emails/:id", | |||
"handler": "template-email.delete", | |||
"config": { | |||
"policies": [] | |||
} | |||
} | |||
] | |||
} |
@@ -0,0 +1,60 @@ | |||
"use strict"; | |||
const { parseMultipartData, sanitizeEntity } = require("strapi-utils"); | |||
/** | |||
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers) | |||
* to customize this controller | |||
*/ | |||
module.exports = { | |||
async create(ctx) { | |||
const decrypted = await strapi.plugins[ | |||
"users-permissions" | |||
].services.jwt.getToken(ctx); | |||
let entity; | |||
if (ctx.is("multipart")) { | |||
const { data, files } = parseMultipartData(ctx); | |||
DATA["last_updated_api_by"] = decrypted.id; | |||
entity = await strapi.services["template-email"].create(data, { | |||
files, | |||
}); | |||
} else { | |||
let data = ctx.request.body; | |||
DATA["last_updated_api_by"] = decrypted.id; | |||
entity = await strapi.services["template-email"].create(data); | |||
} | |||
var entry = sanitizeEntity(entity, { | |||
model: strapi.models["template-email"], | |||
}); | |||
return entry; | |||
}, | |||
async update(ctx) { | |||
const { id } = ctx.params; | |||
const decrypted = await strapi.plugins[ | |||
"users-permissions" | |||
].services.jwt.getToken(ctx); | |||
let entity; | |||
if (ctx.is("multipart")) { | |||
const { data, files } = parseMultipartData(ctx); | |||
data["last_updated_api_by"] = decrypted.id; | |||
entity = await strapi.services["template-email"].update( | |||
{ id }, | |||
data, | |||
{ | |||
files, | |||
} | |||
); | |||
} else { | |||
let data = ctx.request.body; | |||
data["last_updated_api_by"] = decrypted.id; | |||
entity = await strapi.services["template-email"].update( | |||
{ id }, | |||
data | |||
); | |||
} | |||
var entry = sanitizeEntity(entity, { | |||
model: strapi.models["template-email"], | |||
}); | |||
return entry; | |||
}, | |||
}; |
@@ -0,0 +1,8 @@ | |||
'use strict'; | |||
/** | |||
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/models.html#lifecycle-hooks) | |||
* to customize this model | |||
*/ | |||
module.exports = {}; |
@@ -0,0 +1,26 @@ | |||
{ | |||
"kind": "collectionType", | |||
"collectionName": "template_emails", | |||
"info": { | |||
"name": "TemplateEmail" | |||
}, | |||
"options": { | |||
"increments": true, | |||
"timestamps": true, | |||
"draftAndPublish": true | |||
}, | |||
"attributes": { | |||
"template_name": { | |||
"type": "string" | |||
}, | |||
"subject": { | |||
"type": "string" | |||
}, | |||
"text": { | |||
"type": "text" | |||
}, | |||
"html": { | |||
"type": "text" | |||
} | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
'use strict'; | |||
/** | |||
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/services.html#core-services) | |||
* to customize this service | |||
*/ | |||
module.exports = {}; |
@@ -0,0 +1,28 @@ | |||
module.exports = ({ env }) => ({ | |||
email: { | |||
provider: "nodemailer", | |||
providerOptions: { | |||
host: env("SMTP_HOST"), | |||
port: env("SMTP_PORT"), | |||
secure: false, | |||
auth: { | |||
user: env("SMTP_USER"), | |||
pass: env("SMTP_PASSWORD"), | |||
}, | |||
}, | |||
settings: { | |||
defaultFrom: "noreply@thamrin.co.id", | |||
defaultReplyTo: "noreply@thamrin.co.id", | |||
}, | |||
}, | |||
graphql : { | |||
endpoint: "/graphql", | |||
shadowCRUD: true, | |||
playgroundAlways: false, | |||
depthLimit: 1000, | |||
apolloServer: { | |||
tracing: false, | |||
}, | |||
}, | |||
}); | |||
@@ -16,4 +16,16 @@ DATABASE_HOST=172.16.1.8 | |||
DATABASE_PORT=3306 | |||
DATABASE_NAME=thamrin_ecomm_tbg | |||
DATABASE_USERNAME=root | |||
DATABASE_PASSWORD=Master81 | |||
DATABASE_PASSWORD=Master81 | |||
// localhost | |||
DATABASE_HOST=localhost | |||
DATABASE_PORT=3306 | |||
DATABASE_NAME=tbg-ecomm-nextjs | |||
DATABASE_USERNAME=root | |||
DATABASE_PASSWORD= | |||
SMTP_HOST=mail.service.ac.id | |||
SMTP_PORT=587 | |||
SMTP_USER=user_smtp | |||
SMTP_PASSWORD=password_smtp |
@@ -23,6 +23,7 @@ | |||
"strapi-plugin-graphql": "3.4.6", | |||
"strapi-plugin-upload": "3.4.6", | |||
"strapi-plugin-users-permissions": "3.4.6", | |||
"strapi-provider-email-nodemailer": "^3.6.3", | |||
"strapi-utils": "3.4.6" | |||
}, | |||
"author": { | |||
@@ -6651,6 +6651,11 @@ lodash@4.17.20, lodash@^4.1.1, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14 | |||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" | |||
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== | |||
lodash@4.17.21: | |||
version "4.17.21" | |||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" | |||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== | |||
log-symbols@^2.2.0: | |||
version "2.2.0" | |||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" | |||
@@ -7392,6 +7397,11 @@ nodemailer-shared@1.1.0: | |||
dependencies: | |||
nodemailer-fetch "1.6.0" | |||
nodemailer@6.6.0: | |||
version "6.6.0" | |||
resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.6.0.tgz#ed47bb572b48d9d0dca3913fdc156203f438f427" | |||
integrity sha512-ikSMDU1nZqpo2WUPE0wTTw/NGGImTkwpJKDIFPZT+YvvR9Sj+ze5wzu95JHkBMglQLoG2ITxU21WukCC/XsFkg== | |||
noop-logger@^0.1.1: | |||
version "0.1.1" | |||
resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" | |||
@@ -10188,6 +10198,14 @@ strapi-plugin-users-permissions@3.4.6: | |||
strapi-utils "3.4.6" | |||
uuid "^3.1.0" | |||
strapi-provider-email-nodemailer@^3.6.3: | |||
version "3.6.3" | |||
resolved "https://registry.yarnpkg.com/strapi-provider-email-nodemailer/-/strapi-provider-email-nodemailer-3.6.3.tgz#41bf98a7d8d8e11ad7ceb45d9fcfb0461d2749ea" | |||
integrity sha512-teBnVIu/lN3iRJvuj85YAO1lsT0U/kH4SXT0yjvyTLw2qZ7DS3viRq+i+P+FT5uLyMEZpR0yVRXUtvRITC2ohQ== | |||
dependencies: | |||
lodash "4.17.21" | |||
nodemailer "6.6.0" | |||
strapi-provider-email-sendmail@3.4.6: | |||
version "3.4.6" | |||
resolved "https://registry.yarnpkg.com/strapi-provider-email-sendmail/-/strapi-provider-email-sendmail-3.4.6.tgz#6934a0386f53213767b4a320d322ff85fc721922" | |||