Changes from codemod
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/models.html#lifecycle-hooks)
|
||||
* to customize this model
|
||||
*/
|
||||
|
||||
const { ApplicationError } = require("@strapi/utils").errors
|
||||
const slugify = require('slugify')
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
||||
}
|
||||
}
|
||||
|
||||
const user = await strapi.entityService.findOne('plugin::users-permissions.user', body.data.user.id)
|
||||
const user = await strapi.documents('plugin::users-permissions.user').findOne({
|
||||
documentId: "__TODO__"
|
||||
})
|
||||
|
||||
if (!user) {
|
||||
throw new NotFoundError('Utilisateur introuvable.')
|
||||
@@ -43,7 +45,7 @@ module.exports = createCoreController('api::artiste.artiste', ({strapi}) => ({
|
||||
if (artiste) {
|
||||
return artiste
|
||||
} else {
|
||||
const newArtiste = await strapi.entityService.create('api::artiste.artiste', {
|
||||
const newArtiste = await strapi.documents('api::artiste.artiste').create({
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user