Updated WebsiteSelect behavior. Fixed date select.
This commit is contained in:
@@ -3,7 +3,7 @@ import { PrismaClient } from '@/generated/prisma/client';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { readReplicas } from '@prisma/extension-read-replicas';
|
||||
import { SESSION_COLUMNS, OPERATORS, DEFAULT_PAGE_SIZE, FILTER_COLUMNS } from './constants';
|
||||
import { QueryOptions, QueryFilters } from './types';
|
||||
import { QueryOptions, QueryFilters, Operator } from './types';
|
||||
import { filtersObjectToArray } from './params';
|
||||
|
||||
const log = debug('umami:prisma');
|
||||
@@ -143,7 +143,7 @@ function getQueryParams(filters: Record<string, any>) {
|
||||
return {
|
||||
...filters,
|
||||
...filtersObjectToArray(filters).reduce((obj, { name, operator, value }) => {
|
||||
obj[name] = [OPERATORS.contains, OPERATORS.doesNotContain].includes(operator)
|
||||
obj[name] = ([OPERATORS.contains, OPERATORS.doesNotContain] as Operator[]).includes(operator)
|
||||
? `%${value}%`
|
||||
: value;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import { DATA_TYPE, PERMISSIONS, ROLES } from './constants';
|
||||
import { DATA_TYPE, PERMISSIONS, ROLES, OPERATORS } from './constants';
|
||||
import { TIME_UNIT } from './date';
|
||||
|
||||
export type ObjectValues<T> = T[keyof T];
|
||||
@@ -10,6 +10,7 @@ export type TimeUnit = ObjectValues<typeof TIME_UNIT>;
|
||||
export type Permission = ObjectValues<typeof PERMISSIONS>;
|
||||
export type Role = ObjectValues<typeof ROLES>;
|
||||
export type DynamicDataType = ObjectValues<typeof DATA_TYPE>;
|
||||
export type Operator = (typeof OPERATORS)[keyof typeof OPERATORS];
|
||||
|
||||
export interface Auth {
|
||||
user?: {
|
||||
@@ -26,10 +27,10 @@ export interface Auth {
|
||||
|
||||
export interface Filter {
|
||||
name: string;
|
||||
operator: string;
|
||||
operator: Operator;
|
||||
value: string;
|
||||
type?: string;
|
||||
columns?: string;
|
||||
column?: string;
|
||||
prefix?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user