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') }