Rename komant to commentaire
This commit is contained in:
+5
-5
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const jwennTeksEpiId = async teksId => {
|
||||
const teks = await strapi.query('teks').findOne({id: teksId})
|
||||
return teks
|
||||
const paroles = await strapi.query('paroles').findOne({id: teksId})
|
||||
return paroles
|
||||
}
|
||||
|
||||
const jwennUserEpiId = async userId => {
|
||||
@@ -14,11 +14,11 @@ module.exports = {
|
||||
beforeCreate: async event => {
|
||||
let {data} = event
|
||||
|
||||
if (data.kontni && data.teks && data.user) {
|
||||
const teks = await jwennTeksEpiId(data.teks)
|
||||
if (data.kontni && data.paroles && data.user) {
|
||||
const parole = await jwennTeksEpiId(data.parole)
|
||||
const user = await jwennUserEpiId(data.user)
|
||||
|
||||
if(!teks || !user) {
|
||||
if(!parole || !user) {
|
||||
throw strapi.errors.badRequest('Not found')
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"kind": "collectionType",
|
||||
"collectionName": "komante",
|
||||
"collectionName": "commentaires",
|
||||
"info": {
|
||||
"singularName": "komant",
|
||||
"pluralName": "komante",
|
||||
"displayName": "Komante",
|
||||
"singularName": "commentaire",
|
||||
"pluralName": "commentaires",
|
||||
"displayName": "Commentaire",
|
||||
"description": ""
|
||||
},
|
||||
"options": {
|
||||
@@ -25,10 +25,10 @@
|
||||
"relation": "oneToOne",
|
||||
"target": "plugin::users-permissions.user"
|
||||
},
|
||||
"tek": {
|
||||
"parole": {
|
||||
"type": "relation",
|
||||
"relation": "oneToOne",
|
||||
"target": "api::tek.tek"
|
||||
"target": "api::parole.parole"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
const { createCoreController } = require('@strapi/strapi').factories;
|
||||
|
||||
module.exports = createCoreController('api::komant.komant')
|
||||
module.exports = createCoreController('api::commentaire.commentaire')
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||
|
||||
module.exports = createCoreRouter('api::komant.komant')
|
||||
module.exports = createCoreRouter('api::commentaire.commentaire')
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
const { createCoreService } = require('@strapi/strapi').factories;
|
||||
|
||||
module.exports = createCoreService('api::komant.komant');
|
||||
module.exports = createCoreService('api::commentaire.commentaire');
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user