Update services.md

Added entityValidator to create and update service, so it act like the default service and doesn't throw a 500 Error on invalid data.
This commit is contained in:
Simon Appelt 2020-09-23 09:34:38 +02:00 committed by GitHub
parent a0705063b5
commit 510556b5b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,6 +139,7 @@ module.exports = {
*/
async create(data, { files } = {}) {
await strapi.entityValidator.validateEntity(strapi.models.restaurant, data);
const entry = await strapi.query('restaurant').create(data);
if (files) {
@ -170,6 +171,7 @@ module.exports = {
*/
async update(params, data, { files } = {}) {
await strapi.entityValidator.validateEntityUpdate(strapi.models.restaurant, data);
const entry = await strapi.query('restaurant').update(params, data);
if (files) {