The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix getLinksForWorkspace search
Steven Teyc1cf8b7b179a
diff --git a/apps/web/lib/api/links/get-links-for-workspace.ts b/apps/web/lib/api/links/get-links-for-workspace.tsindex 2fca5a3f1e..f30b09bf9c 100644--- a/apps/web/lib/api/links/get-links-for-workspace.ts+++ b/apps/web/lib/api/links/get-links-for-workspace.ts@@ -43,36 +43,48 @@ export async function getLinksForWorkspace({where: {projectId: workspaceId,archived: showArchived ? undefined : false,- ...(folderIds- ? {- OR: [+ AND: [+ ...(folderIds+ ? [{- folderId: {- in: folderIds,- },+ OR: [+ {+ folderId: {+ in: folderIds,+ },+ },+ {+ folderId: null,+ },+ ],},+ ]+ : [{- folderId: null,+ folderId: folderId || null,},- ],- }- : {- folderId: folderId || null,- }),+ ]),+ ...(search+ ? [+ {+ ...(searchMode === "fuzzy" && {+ OR: [+ {+ shortLink: { contains: search },+ },+ {+ url: { contains: search },+ },+ ],+ }),+ ...(searchMode === "exact" && {+ shortLink: { startsWith: search },+ }),+ },+ ]+ : []),+ ],...(domain && { domain }),- ...(search && {- ...(searchMode === "fuzzy" && {- OR: [- {- shortLink: { contains: search },- },- {- url: { contains: search },- },- ],- }),- ...(searchMode === "exact" && { shortLink: { startsWith: search } }),- }),...(withTags && {tags: {some: {},