Skip to content

Commit

Permalink
fix(worker): Cast mod log case id to string before searching
Browse files Browse the repository at this point in the history
  • Loading branch information
tzushimelon committed Feb 7, 2024
1 parent 7794639 commit 9093dfb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/sushii-worker/src/db/ModLog/ModLog.repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DeleteResult, Kysely } from "kysely";
import { DeleteResult, Kysely, sql } from "kysely";
import { DB } from "../../model/dbTypes";
import { InsertableModLogRow, ModLogRow } from "./ModLog.table";

Expand Down Expand Up @@ -123,7 +123,11 @@ export function searchModLogsByIDPrefix(
.selectFrom("app_public.mod_logs")
.selectAll()
.where("guild_id", "=", guildId)
.where("case_id", "like", `${searchCaseId}%`)
.where(
(eb) => sql<string>`cast(${eb.ref("case_id")} as text)`,
"like",
`${searchCaseId}%`,
)
// Newest first - top newest in autocomplete
.orderBy("case_id", "desc")
.limit(maxResults)
Expand Down

0 comments on commit 9093dfb

Please sign in to comment.