From a5f6e3334a0f113cb347e4abbe1b325789198ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sun, 27 Mar 2022 02:07:22 +0400 Subject: [PATCH] Fix komante query --- api/komante/models/komante.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/komante/models/komante.js b/api/komante/models/komante.js index e974cb9..4014555 100644 --- a/api/komante/models/komante.js +++ b/api/komante/models/komante.js @@ -1,12 +1,12 @@ 'use strict'; const jwennTeksEpiId = async teksId => { - const teks = await strapi.query('teks').find({_id: teksId}) + const teks = await strapi.query('teks').findOne({_id: teksId}) return teks } 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 } @@ -17,7 +17,7 @@ module.exports = { const teks = await jwennTeksEpiId(data.teks) const user = await jwennUserEpiId(data.user) - if(!teks.length > 0 || !user.length > 0) { + if(!teks || !user) { throw strapi.errors.badRequest('Not found') }