feat: add text filter on org member list (#17632)
* feat: improve text filters (WIP) * move function to bottom * apply some styles * fix selection of TextFilterOptions * rename value to operand * remove unused file * merge filters/filters into filters/utils * fix regression of not putting url params correctly * move makeWhereClause to filters/utils * fix negative, empty, and not empty operators * fix initial filtering from search state (url) * fix type errors * do not send an empty array to query * update yarn.lock * i18n for text filter operators * extract logic as useColumnFilters() * add missing import * fix type error * revert yarn.lock * use i18n * insensitive text match * move data-table to @calcom/features * fix type errors * fix type errors * fix type errors --------- Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 parent
ff18b9a733
commit
1404581f78
28 files changed
+520
-309
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { makeWhereClause } from "@calcom/features/data-table/lib/server";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
@@ -66,7 +67,7 @@ export const listMembersHandler = async ({ ctx, input }: GetOptions) => {
|
||||
some: {
|
||||
team: {
|
||||
name: {
|
||||
in: filter.value,
|
||||
in: filter.value as string[],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -81,9 +82,7 @@ export const listMembersHandler = async ({ ctx, input }: GetOptions) => {
|
||||
attribute: {
|
||||
id: filter.id,
|
||||
},
|
||||
value: {
|
||||
in: filter.value,
|
||||
},
|
||||
...makeWhereClause("value", filter.value),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import { ZFilterValue } from "@calcom/features/data-table";
|
||||
|
||||
const expandableColumns = z.enum(["attributes"]);
|
||||
|
||||
const ZListMembersFilter = z.object({
|
||||
id: z.string(),
|
||||
value: ZFilterValue,
|
||||
});
|
||||
|
||||
export const ZListMembersSchema = z.object({
|
||||
limit: z.number().min(1).max(100),
|
||||
cursor: z.number().nullish(),
|
||||
searchTerm: z.string().optional(),
|
||||
expand: z.array(expandableColumns).optional(),
|
||||
filters: z
|
||||
.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
value: z.array(z.string()),
|
||||
})
|
||||
)
|
||||
.optional(),
|
||||
filters: z.array(ZListMembersFilter).optional(),
|
||||
});
|
||||
|
||||
export type TListMembersSchema = z.infer<typeof ZListMembersSchema>;
|
||||
Reference in new issue
Block a user