fixup where

This commit is contained in:
Wroclaw 2023-05-11 11:02:08 +02:00
parent b14cf774ec
commit 775cc2e1db

View file

@ -67,7 +67,7 @@ export default class BaaPagination<T extends {[k: string]: any}, keyType extends
where = "",
bind: Array<any> = [],
) {
const sqlwhere = where ? `AND (${where})` : "";
const sqlwhere = where !== "" ? `AND (${where})` : "";
switch (queryType.type) {
case "before": {
const [data] = await database.query(
@ -232,7 +232,7 @@ export default class BaaPagination<T extends {[k: string]: any}, keyType extends
where = "",
bind: Array<any> = [],
) {
const sqlwhere = where ? `WHERE ${where}` : "";
const sqlwhere = where !== "" ? `WHERE ${where}` : "";
const [[data]] = await database.query(
`SELECT COUNT(*) as \`count\` FROM \`${this.table}\` ${sqlwhere}`,
bind,