mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 05:37:20 +01:00
Add Search Api/Components.
This commit is contained in:
parent
45888fabe6
commit
dcf8b2edaa
37 changed files with 1069 additions and 287 deletions
55
lib/types.ts
55
lib/types.ts
|
|
@ -1,17 +1,62 @@
|
|||
import { NextApiRequest } from 'next';
|
||||
import { COLLECTION_TYPE, DATA_TYPE, EVENT_TYPE, KAFKA_TOPIC, ROLES } from './constants';
|
||||
import {
|
||||
COLLECTION_TYPE,
|
||||
DATA_TYPE,
|
||||
EVENT_TYPE,
|
||||
KAFKA_TOPIC,
|
||||
REPORT_FILTER_TYPES,
|
||||
ROLES,
|
||||
TEAM_FILTER_TYPES,
|
||||
USER_FILTER_TYPES,
|
||||
WEBSITE_FILTER_TYPES,
|
||||
} from './constants';
|
||||
|
||||
type ObjectValues<T> = T[keyof T];
|
||||
|
||||
export type CollectionType = ObjectValues<typeof COLLECTION_TYPE>;
|
||||
|
||||
export type Role = ObjectValues<typeof ROLES>;
|
||||
|
||||
export type EventType = ObjectValues<typeof EVENT_TYPE>;
|
||||
|
||||
export type DynamicDataType = ObjectValues<typeof DATA_TYPE>;
|
||||
|
||||
export type KafkaTopic = ObjectValues<typeof KAFKA_TOPIC>;
|
||||
export type ReportSearchFilterType = ObjectValues<typeof REPORT_FILTER_TYPES>;
|
||||
export type UserSearchFilterType = ObjectValues<typeof USER_FILTER_TYPES>;
|
||||
export type WebsiteSearchFilterType = ObjectValues<typeof WEBSITE_FILTER_TYPES>;
|
||||
export type TeamSearchFilterType = ObjectValues<typeof TEAM_FILTER_TYPES>;
|
||||
|
||||
export interface WebsiteSearchFilter extends SearchFilter<WebsiteSearchFilterType> {
|
||||
userId?: string;
|
||||
teamId?: string;
|
||||
includeTeams?: boolean;
|
||||
}
|
||||
|
||||
export interface UserSearchFilter extends SearchFilter<UserSearchFilterType> {
|
||||
teamId?: string;
|
||||
}
|
||||
|
||||
export interface TeamSearchFilter extends SearchFilter<TeamSearchFilterType> {
|
||||
userId?: string;
|
||||
}
|
||||
|
||||
export interface ReportSearchFilter extends SearchFilter<ReportSearchFilterType> {
|
||||
userId?: string;
|
||||
websiteId?: string;
|
||||
}
|
||||
|
||||
export interface SearchFilter<T> {
|
||||
filter?: string;
|
||||
filterType?: T;
|
||||
pageSize?: number;
|
||||
page?: number;
|
||||
orderBy?: string;
|
||||
}
|
||||
|
||||
export interface FilterResult<T> {
|
||||
data: T;
|
||||
count: number;
|
||||
pageSize: number;
|
||||
page: number;
|
||||
orderBy?: string;
|
||||
}
|
||||
|
||||
export interface DynamicData {
|
||||
[key: string]: number | string | DynamicData | number[] | string[] | DynamicData[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue