Fix komante query

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-03-27 02:07:22 +04:00
parent 76ed801518
commit a5f6e3334a
+3 -3
View File
@@ -1,12 +1,12 @@
'use strict'; 'use strict';
const jwennTeksEpiId = async teksId => { const jwennTeksEpiId = async teksId => {
const teks = await strapi.query('teks').find({_id: teksId}) const teks = await strapi.query('teks').findOne({_id: teksId})
return teks return teks
} }
const jwennUserEpiId = async userId => { const jwennUserEpiId = async userId => {
const user = await strapi.query('user', 'users-permissions').find({_id: userId}) const user = await strapi.query('user', 'users-permissions').findOne({_id: userId})
return user return user
} }
@@ -17,7 +17,7 @@ module.exports = {
const teks = await jwennTeksEpiId(data.teks) const teks = await jwennTeksEpiId(data.teks)
const user = await jwennUserEpiId(data.user) const user = await jwennUserEpiId(data.user)
if(!teks.length > 0 || !user.length > 0) { if(!teks || !user) {
throw strapi.errors.badRequest('Not found') throw strapi.errors.badRequest('Not found')
} }