diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-04-28 07:29:23 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-04-28 07:29:23 +0000 |
| commit | 5912277981fc27cd96cb9239565a1148d7e6fc8f (patch) | |
| tree | d99fcef6de6f26b63550a2e606cdc06cbcb579df /packages/trpc/models/lists.ts | |
| parent | d42c196729ecddc2b8646ce15be6cd2b362c05a6 (diff) | |
| download | karakeep-5912277981fc27cd96cb9239565a1148d7e6fc8f.tar.zst | |
Revert "fix: Fix smart lists not working in list search qualifiers". #1321
This reverts commit 6178736d64180f9bc8954099c90d54aa2f9f35f5.
Diffstat (limited to 'packages/trpc/models/lists.ts')
| -rw-r--r-- | packages/trpc/models/lists.ts | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/packages/trpc/models/lists.ts b/packages/trpc/models/lists.ts index d278f8d9..4da127d2 100644 --- a/packages/trpc/models/lists.ts +++ b/packages/trpc/models/lists.ts @@ -26,7 +26,7 @@ export abstract class List implements PrivacyAware { private static fromData( ctx: AuthedContext, data: ZBookmarkList & { userId: string }, - ): ManualList | SmartList { + ) { if (data.type === "smart") { return new SmartList(ctx, data); } else { @@ -34,21 +34,6 @@ export abstract class List implements PrivacyAware { } } - static async fromName( - ctx: AuthedContext, - name: string, - ): Promise<(ManualList | SmartList)[]> { - // Names are not unique, so we need to find all lists with the same name - const lists = await ctx.db.query.bookmarkLists.findMany({ - where: and( - eq(bookmarkLists.name, name), - eq(bookmarkLists.userId, ctx.user.id), - ), - }); - - return lists.map((l) => this.fromData(ctx, l)); - } - static async fromId( ctx: AuthedContext, id: string, @@ -66,7 +51,11 @@ export abstract class List implements PrivacyAware { message: "List not found", }); } - return this.fromData(ctx, list); + if (list.type === "smart") { + return new SmartList(ctx, list); + } else { + return new ManualList(ctx, list); + } } static async create( |
