Fix komante query
This commit is contained in:
@@ -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')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user