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

Commit

Permalink
fix(manager): build the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 16, 2022
1 parent 232aa3f commit efec313
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions database/managers/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ export default class extends BaseManager<
) as unknown as [ { id: number, userID: string }[] ]
const userIDs = rawUserIDs.map(info => info.userID)

if (userIDs.length === 0) return false

const [ counts ] = await Model.sequelize.query(
// @ts-ignore
AttachedRole.sequelize.getQueryInterface().queryGenerator.selectQuery(
Expand All @@ -157,10 +155,11 @@ export default class extends BaseManager<
[ "userID" ]
],
"having": new Condition().equal("roleIDCount", 1).build(),
"where": new Condition().isIncludedIn("userID", userIDs)
"where": new Condition().isIncludedIn("userID", userIDs).build()
}
)
) as unknown as [ { id: number, count: string }[] ]

return counts.length > 0
} catch (error) {
throw this.makeBaseError(error)
Expand Down

0 comments on commit efec313

Please sign in to comment.