mirror of
https://github.com/strapi/strapi.git
synced 2025-12-30 00:37:24 +00:00
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:
parent
a0705063b5
commit
510556b5b5
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user