Skip to content

Commit

Permalink
fix: condition query
Browse files Browse the repository at this point in the history
  • Loading branch information
baptadn committed Jan 21, 2025
1 parent 5798085 commit 55e19a8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions back/api/application/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,33 @@ module.exports = {
const applications = await strapi.services.application.find(
{
id,
status: ['validated', 'confirmed'],
},
[
'id',
'creation_title',
'company',
],
)

const application = applications.length > 0 ? applications[0] : null

if (!application) {
return { count: 0 }
}

const applicationsCount = await strapi.services.application.find(
{
creation_title: application.creation_title,
company: application.company.id,
status_in: ['validated', 'confirmed'],
},
[
'id',
'creation_title',
'company',
],
)

return { count: applications?.length || 0 }
return { count: applicationsCount?.length || 0 }
},
}

0 comments on commit 55e19a8

Please sign in to comment.