Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
fix(manager): limit the count to existing users
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Dec 6, 2022
1 parent 022b40d commit b5914e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions database/managers/department.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ export default class extends BaseManager<
User.sequelize.getQueryInterface().queryGenerator.selectQuery(
User.tableName, {
"attributes": [ User.sequelize.fn("count", "*") ],
"where": new Condition().equal(
"departmentID",
User.sequelize.col(`${Model.tableName}.id`)
"where": new Condition().and(
new Condition().equal(
"departmentID",
User.sequelize.col(`${Model.tableName}.id`)
),
new Condition().is("deletedAt", null)
)
.build()
}
Expand Down

0 comments on commit b5914e7

Please sign in to comment.