fix(medusa-plugin-economic,medusa-plugin-mailchimp,medusa-plugin-restock-notification,medusa-plugin-sendgrid,medusa-plugin-wishlist): Temporarily remove payload validation in some plugins (#3763)

* Temporarily remove payload validation in some plugins

* Add changeset

* chore: Remove commented out code

* Revert discount generator plugin

---------

Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Rares Stefan
2023-04-08 21:09:13 +02:00
committed by GitHub
co-authored by olivermrbl Oliver Windall Juhl
parent 282e239dfc
commit 4104d9ccb2
7 changed files with 79 additions and 172 deletions
@@ -1,23 +1,10 @@
import { Validator, MedusaError } from "medusa-core-utils"
export default async (req, res) => {
const { variant_id } = req.params
const schema = Validator.object().keys({
email: Validator.string().required(),
})
const { value, error } = schema.validate(req.body)
if (error) {
res.status(400).json({ message: error.message })
return
}
try {
const restockNotificationService = req.scope.resolve(
"restockNotificationService"
)
await restockNotificationService.addEmail(variant_id, value.email)
await restockNotificationService.addEmail(variant_id, req.body.email)
res.sendStatus(201)
} catch (err) {
res.status(400).json({ message: err.message })