Rename komant to commentaire

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-12 18:44:49 +04:00
parent d906450f05
commit 00bb95be22
6 changed files with 14 additions and 2337 deletions
@@ -1,8 +1,8 @@
'use strict'; 'use strict';
const jwennTeksEpiId = async teksId => { const jwennTeksEpiId = async teksId => {
const teks = await strapi.query('teks').findOne({id: teksId}) const paroles = await strapi.query('paroles').findOne({id: teksId})
return teks return paroles
} }
const jwennUserEpiId = async userId => { const jwennUserEpiId = async userId => {
@@ -14,11 +14,11 @@ module.exports = {
beforeCreate: async event => { beforeCreate: async event => {
let {data} = event let {data} = event
if (data.kontni && data.teks && data.user) { if (data.kontni && data.paroles && data.user) {
const teks = await jwennTeksEpiId(data.teks) const parole = await jwennTeksEpiId(data.parole)
const user = await jwennUserEpiId(data.user) const user = await jwennUserEpiId(data.user)
if(!teks || !user) { if(!parole || !user) {
throw strapi.errors.badRequest('Not found') throw strapi.errors.badRequest('Not found')
} }
@@ -1,10 +1,10 @@
{ {
"kind": "collectionType", "kind": "collectionType",
"collectionName": "komante", "collectionName": "commentaires",
"info": { "info": {
"singularName": "komant", "singularName": "commentaire",
"pluralName": "komante", "pluralName": "commentaires",
"displayName": "Komante", "displayName": "Commentaire",
"description": "" "description": ""
}, },
"options": { "options": {
@@ -25,10 +25,10 @@
"relation": "oneToOne", "relation": "oneToOne",
"target": "plugin::users-permissions.user" "target": "plugin::users-permissions.user"
}, },
"tek": { "parole": {
"type": "relation", "type": "relation",
"relation": "oneToOne", "relation": "oneToOne",
"target": "api::tek.tek" "target": "api::parole.parole"
} }
} }
} }
@@ -2,4 +2,4 @@
const { createCoreController } = require('@strapi/strapi').factories; 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; 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; 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