This commit is contained in:
xfarrow 2024-03-18 16:13:48 +01:00
parent 7ef8cd4a48
commit 61f021db3c
2 changed files with 4 additions and 1 deletions

View File

@ -31,7 +31,7 @@ async function insert(requester, organizationId, title, description, requirement
.returning('*'); .returning('*');
// Insert in the JobOfferTag table all the relevant tags. // Insert in the JobOfferTag table all the relevant tags.
if (tags.length !== 0) { if (tags) {
await Promise.all(tags.map(tag => await Promise.all(tags.map(tag =>
tr('JobOfferTag').insert({ tr('JobOfferTag').insert({
job_offer_id: jobOffer[0].id, job_offer_id: jobOffer[0].id,

View File

@ -14,6 +14,9 @@
const knex = require('../utils/knex_config'); const knex = require('../utils/knex_config');
async function findByTags(tags) { async function findByTags(tags) {
if(!tags){
return null;
}
tags = tags.map(tag => tag.toLowerCase()); tags = tags.map(tag => tag.toLowerCase());
const result = await knex('Tag') const result = await knex('Tag')
.whereIn('tag', tags) .whereIn('tag', tags)