feat: add list filter to board view (#241)

* feat: add list filter to board view

* feat: implement API-driven list filtering

* refactor: remove unnecessary list join from card filtering queries

* feat: enable list filter options for public boards

* refactor(perf): move to main query

---------

Co-authored-by: Henry <henry_ball@hotmail.co.uk>
This commit is contained in:
Arpit Soni
2025-11-18 02:55:50 +05:30
committed by GitHub
parent c0a3c37d95
commit af6490896a
11 changed files with 70 additions and 1 deletions

View File

@@ -70,6 +70,7 @@ export const getByPublicId = async (
filters: {
members: string[];
labels: string[];
lists: string[];
type: "regular" | "template" | undefined;
},
) => {
@@ -231,6 +232,19 @@ export const getByPublicId = async (
orderBy: [asc(cards.index)],
},
},
where: and(
isNull(lists.deletedAt),
filters.lists.length > 0
? inArray(lists.publicId, filters.lists)
: undefined,
),
orderBy: [asc(lists.index)],
},
allLists: {
columns: {
publicId: true,
name: true,
},
where: isNull(lists.deletedAt),
orderBy: [asc(lists.index)],
},
@@ -268,6 +282,7 @@ export const getBySlug = async (
filters: {
members: string[];
labels: string[];
lists: string[];
},
) => {
let cardIds: string[] = [];
@@ -379,6 +394,19 @@ export const getBySlug = async (
orderBy: [asc(cards.index)],
},
},
where: and(
isNull(lists.deletedAt),
filters.lists.length > 0
? inArray(lists.publicId, filters.lists)
: undefined,
),
orderBy: [asc(lists.index)],
},
allLists: {
columns: {
publicId: true,
name: true,
},
where: isNull(lists.deletedAt),
orderBy: [asc(lists.index)],
},

View File

@@ -73,6 +73,7 @@ export const boardsRelations = relations(boards, ({ one, many }) => ({
relationName: "boardCreatedByUser",
}),
lists: many(lists),
allLists: many(lists),
labels: many(labels),
deletedBy: one(users, {
fields: [boards.deletedBy],