From 5912277981fc27cd96cb9239565a1148d7e6fc8f Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Mon, 28 Apr 2025 07:29:23 +0000 Subject: Revert "fix: Fix smart lists not working in list search qualifiers". #1321 This reverts commit 6178736d64180f9bc8954099c90d54aa2f9f35f5. --- packages/trpc/models/lists.ts | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'packages/trpc/models/lists.ts') 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( -- cgit v1.2.3-70-g09d2