feature(dashboard): add ability to filter out events by profile id and ip (#101)
This commit is contained in:
committed by
GitHub
parent
27ee623584
commit
f4ad97d87d
@@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "projects" ADD COLUMN "cors" TEXT,
|
||||
ADD COLUMN "crossDomain" BOOLEAN NOT NULL DEFAULT false,
|
||||
ADD COLUMN "domain" TEXT,
|
||||
ADD COLUMN "filters" JSONB NOT NULL DEFAULT '[]';
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The `cors` column on the `projects` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "projects" DROP COLUMN "cors",
|
||||
ADD COLUMN "cors" TEXT[] DEFAULT ARRAY[]::TEXT[];
|
||||
@@ -80,6 +80,11 @@ model Project {
|
||||
organizationId String
|
||||
eventsCount Int @default(0)
|
||||
types ProjectType[] @default([])
|
||||
domain String?
|
||||
cors String[] @default([])
|
||||
crossDomain Boolean @default(false)
|
||||
/// [IPrismaProjectFilters]
|
||||
filters Json @default("[]")
|
||||
|
||||
events Event[]
|
||||
profiles Profile[]
|
||||
|
||||
@@ -39,7 +39,7 @@ export const CLICKHOUSE_OPTIONS: NodeClickHouseClientConfigOptions = {
|
||||
|
||||
export const originalCh = createClient({
|
||||
// TODO: remove this after migration
|
||||
url: process.env.CLICKHOUSE_URL_CLUSTER ?? process.env.CLICKHOUSE_URL,
|
||||
url: process.env.CLICKHOUSE_URL_DIRECT ?? process.env.CLICKHOUSE_URL,
|
||||
...CLICKHOUSE_OPTIONS,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { cacheable } from '@openpanel/redis';
|
||||
import type { Client, Prisma } from '../prisma-client';
|
||||
import { db } from '../prisma-client';
|
||||
|
||||
@@ -21,3 +22,16 @@ export async function getClientsByOrganizationId(organizationId: string) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function getClientById(
|
||||
id: string,
|
||||
): Promise<IServiceClientWithProject | null> {
|
||||
return db.client.findUnique({
|
||||
where: { id },
|
||||
include: {
|
||||
project: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const getClientByIdCached = cacheable(getClientById, 60 * 60 * 24);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
IIntegrationConfig,
|
||||
INotificationRuleConfig,
|
||||
IProjectFilters,
|
||||
} from '@openpanel/validation';
|
||||
import type { INotificationPayload } from './services/notification.service';
|
||||
|
||||
@@ -9,5 +10,6 @@ declare global {
|
||||
type IPrismaNotificationRuleConfig = INotificationRuleConfig;
|
||||
type IPrismaIntegrationConfig = IIntegrationConfig;
|
||||
type IPrismaNotificationPayload = INotificationPayload;
|
||||
type IPrismaProjectFilters = IProjectFilters[];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user