aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/lib/search.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/trpc/lib/search.ts')
-rw-r--r--packages/trpc/lib/search.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/trpc/lib/search.ts b/packages/trpc/lib/search.ts
index 74aaf51b..eac323df 100644
--- a/packages/trpc/lib/search.ts
+++ b/packages/trpc/lib/search.ts
@@ -7,6 +7,7 @@ import {
like,
lt,
lte,
+ ne,
notExists,
notLike,
} from "drizzle-orm";
@@ -233,6 +234,15 @@ async function getIds(
),
);
}
+ case "type": {
+ const comp = matcher.inverse
+ ? ne(bookmarks.type, matcher.typeName)
+ : eq(bookmarks.type, matcher.typeName);
+ return db
+ .select({ id: bookmarks.id })
+ .from(bookmarks)
+ .where(and(eq(bookmarks.userId, userId), comp));
+ }
case "and": {
const vals = await Promise.all(
matcher.matchers.map((m) => getIds(db, userId, m)),